public class Hope{
public static void main(String argv[]){
Hope h = new Hope();
}
protected Hope(){
for(int i =0; i <10; i++ )
System.out.println(i);
}
}
}
1) Compilation error: Constructors cannot be declared protected
2) Run time error: Constructors cannot be declared protected
3) Compilation and running with output 0 to 10
4) Compilation and running with output 0 to 9
Answer)
4) Compilation and running with output 0 to 9
No comments:
Post a Comment