Now Suppose we have two file Demo.java and Loading.java
Demo.java
Demo.java
class Demo{
static{
System.out.println("Demo Static Block");
}
}
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());
}
}
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.