When we call the "public static void main(
String args[]) " method, why is the constructor not called. Is it not initializing the class.
When I execute this class: It does intialize the variable i and the static block. Why is the constructor not being called ? Why does constructor get called only when we create an instance using "new". In the program below is "Allgo" object not getting instantiated when the main() is getting called ?
public class Allgo {
static int i=6 ;
static {
System.out.println("--static--"+i);
}
Allgo(){
System.out.println("--const--"+i);
}
public static void main(String args[])
{
}
Thanks in advance