PROGRAM
public class Lab
{
public static void main(String[] a) {
DataStructure t = new Lab();
DataStructure t1 = new Lab();
System.out.println("Main");
}
Lab() {
System.out.println("Constructor");
}
static {
System.out.println("Static");
}
}
OUTPUT
Static --> Static block is executed as soon as JVM loads the class and only onceConstructor
Constructor
Main
No comments:
Post a Comment