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

16 lines
338 B
Java

class Example5 {
static int i;
static String s;
public static void main(String args[]) { //Its a Static Method
Example5 obj = new Example5();
//Non Static variables accessed using object obj
System.out.println("i:" + obj.i);
System.out.println("s:" + obj.s);
}
}
//Output:
//i:0
//s:null