无忧首页企业系统我的无忧
无忧服务:
兼职活动培训
娱乐交友:
交友社区资讯
全职实习:
实习暑假寒假
微信号:school51
扫一下,立即关注
加关注
在线支付,立省10元
下载新版APP
===大学生成长生活平台===

JAVA题库:格林模拟试题三(下)(5)

2012-12-26来源/作者:卫凯点击次数:504

 

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





相关阅读



关于我们 | 联系我们 | 用户指南 | 网站地图 | 意见建议 | 会员注册 | 用户协议 | 隐私政策