Executing the Test class gives a StackOverFlow error :(
Parent class :
package Pack;
public class Alpha {
protected void sayHi() {
System.out.println("Hi...from Alpha");
}
}
Child class :
import Pack.Alpha;
public class AlphaSub extends Alpha {
AlphaSub sb=new AlphaSub() ;
void hi() {
sb.sayHi() ;
}
}
Test class :
public class test {
public static void main(String[] args) {
AlphaSub ob=new AlphaSub() ;
ob.hi() ;
}
}