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

18 lines
356 B
Java

class Example2{
int num;
//Static class
static class X{
static String str="Inside Class X";
num=99;
// static int num = 99;
// would be the correct syntax
}
public static void main(String args[]){
Example2.X obj = new Example2.X();
System.out.println("Value of num="+obj.str);
}
}