Upload files to "OOP/Java/Lab/Week7/ExampleQues"

This commit is contained in:
Aadit Agrawal 2024-09-14 01:56:07 +05:30
parent 3c665489ed
commit 6b9647add4
5 changed files with 94 additions and 0 deletions

View 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{
// ^