OOPS.................

Sunday, January 4, 2009

Can we call a private cunstructor of super class directelyWhat will happen when you attempt to compile and run the following code?

class Vict{
private Vict(){
System.out.print("Vict");
}
}

public class BLBeck extends Vict{
public static void main(String argv[]){
new BLBeck();
}

BLBeck(){
System.out.print("BLBeck");
}
}



1:Compilation and output of "BLBeck"
2:Compilation and output of "BLBeckVict"
3:Compilation and output of "VictBLBeck"
4:Compile time error

No comments: