Upload files to "OOP/Java/Lab/Week7/ExampleQues"
This commit is contained in:
parent
3c665489ed
commit
6b9647add4
5 changed files with 94 additions and 0 deletions
28
OOP/Java/Lab/Week7/ExampleQues/Example4.java
Normal file
28
OOP/Java/Lab/Week7/ExampleQues/Example4.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
class Example4{
|
||||
static int num;
|
||||
static String mystr;
|
||||
|
||||
//First Static
|
||||
block static{
|
||||
System.out.println("Static Block 1");
|
||||
num = 68;
|
||||
mystr = "Block1";
|
||||
}
|
||||
|
||||
//Second static
|
||||
|
||||
block static{
|
||||
System.out.println("Static Block 2");
|
||||
num = 98;
|
||||
mystr = "Block2";
|
||||
}
|
||||
|
||||
public static void main(String args[]){
|
||||
System.out.println("Value of num="+num);
|
||||
}
|
||||
}
|
||||
|
||||
// Error:
|
||||
// Example4.java:6: error: <identifier> expected
|
||||
// block static{
|
||||
// ^
|
Loading…
Add table
Add a link
Reference in a new issue