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

Saturday, January 3, 2009

What will happen when you attempt to compile and run the following code?

class Craven{
Craven(){
System.out.println("Craven");
}
}
public class CilDig extends Craven{
public static void main(String argv[]){
CilDig _c = new CilDig();
}
public CilDig(){

System.out.println("CilDig");
}
}

Answers:
1:Compile time error, an object reference cannot start with underscore
2:Compilation and output of "CilDig"
3: Compilation and output of "Craven" followed by "CilDig"
4: Compile time error, method CilDig has no return type

No comments: