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

JAVA题库:格林模拟试题一(上)(6)

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

 

question 20)
what will be displayed when you attempt to compile and run the following code

//code start
import java.awt.*;
public class butt extends frame{
public static void main(string argv[]){
butt mybut=new butt();
}
butt(){
button hellobut=new button("hello");
button byebut=new button("bye");
add(hellobut);
add(byebut);
setsize(300,300);
setvisible(true);
}
}
//code end

1) two buttons side by side occupying all of the frame, hello on the left and bye on the right
2) one button occupying the entire frame saying hello
3) one button occupying the entire frame saying bye
4) two buttons at the top of the frame one saying hello the other saying bye

question 21)
what will be output by the following code?

public class myfor{
public static void main(string argv[]){
int i;
int j;
outer:
for (i=1;i <3;i++)
inner:
for(j=1; j<3; j++) {
if (j==2)
continue outer;
system.out.println("value for i=" + i + " value for j=" +j);
}
}

}

1) value for i=1 value for j=1
2) value for i=2 value for j=1
3) value for i=2 value for j=2
4) value for i=3 value for j=1





相关阅读



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