MIT-Curricular/OOP/Java/Lab/Week7/ExampleQues/Example3.java

21 lines
418 B
Java
Raw Normal View History

class Example3 {
static int num;
static String mystr;
static {
num = 97;
mystr = "Static keyword in Java";
}
public static void main(String args[]) {
System.out.println("Value of num=" + num);
System.out.println("Value of mystr=" + mystr);
}
}
// Last } wasn't included, but I added it.
// Output:
// Value of num=97
// Value of mystr=Static keyword in Java