JAVA题库:格林模拟试题三(下)(5)
文章作者 100test 发表时间 2007:03:14 17:38:05
来源 100Test.Com百考试题网
question 45)
what will happen when you attempt to compile and run the following code?
public class sandys{
private int court.
public static void main(string argv[]){
sandys s = new sandys(99).
system.out.println(s.court).
}
sandys(int ballcount){
court=ballcount.
}
}
1) compile time error, the variable court is defined as private
2) compile time error, s is not initialized when the system.out method is called
3) compilation and execution with no output
4) compilation and run with an output of 99
question 46)
which of the following statements are true?
1) a method cannot be overloaded to be less public in a child class
2) to be overridden a method only needs the same name and parameter types
3) to be overridden a method must have the same name, parameter and return types
4) an overridden method must have the same name, parameter names and parameter types
question 47)
what will happen when you attempt to compile and run the following code?
class base{
base(){
system.out.println("base").
}
}
public class checket extends base{
public static void main(string argv[]){
checket c = new checket().
super().
}
checket(){
system.out.println("checket").
}
}
1) compile time error
2) checket followed by base
3) base followed by checket
4) runtime error