11 How ".class" file is loading by using ClassName.class file

Now Suppose we have two file Demo.java and Loading.java

Demo.java

class Demo{
static{
System.out.println("Demo Static Block");
}
}

Loading.java

class Loading{
public static void main(String[] r){
     Class cls=Demo.class;
     System.out.println(cls.getName());   
}
}




If Demo.class file is not loading then it will not showing the type. 
Previous
Next Post »