Hi,
The following program compiles fine. when I run the program I expected "hai" will be printed on the console before "hello".
But "hai" is not printed on console.. why?
public class Test{
Test tst=new Test();
Test(){
System.out.println("hai");
}
public static void main(
String args[]){
System.out.println("hello");
}
}
After I changed the above code like the following...
public class Test{
Test tst=new Test();
Test(){
System.out.println("hai");
}
public static void main(String args[]){
Test t=new Test();
System.out.println("hello");
}
}
At Runtime I encountered the follwing Exception.
java.lang.StockOverflowError. Is it a sub class of java.lang.Error.
Any help greatly appriciated.....