Professional Documents
Culture Documents
Inner classes can be in a separate jar (Same class loader having both the jars in its classpath)
Program :
class innerTest {
static{
System.out.println("INNER OUTER/MAIN CLASS LOADED --> JAR 1 or 2");
}
class A {
{
System.out.println("INNER CLASS A LOADED --> JAR 1 or 2");
}
}
static class B{
{
System.out.println("INNER CLASS B LOADED --> JAR 1 or 2");
}
}
}
System.out.println("#######MAIN#########");
}
Program :
class innerTest {
static{ System.out.println("INNER OUTER/MAIN CLASS LOADED --> JAR 1 or 2");}
class A {
static class B{
System.out.println("#######MAIN#########");
}
}
====================================================================
class A {
{
System.out.println("INNER CLASS A LOADED --> JAR 2");
Runnable r = new Runnable(){
public void run(){
};
}
}
SEALED=true flag will not behave this way as it will load all the classes of the same package from the
same jar