《JAVA 语言程序设计》期末考试试题及答案 3(应
考必备题库)
一、单项选择题
1、如下哪个是 Java 中的标识符()
A、public B、super C、3number D、width
2、如下哪个是 Java 中的标识符( )
A、fieldname B、super C、3number D、#number
3、已知如下定义:String s = "story"; 下面哪个语句不是合法的( )
A、s += "books"; B、s = s + 100;
C、int len = s.length; D、String t = s + “abc”;
4、如下哪个是 Java 中有效的关键字()
A、name B、hello C、false D、good
5、下面的代码段执行之后 count 的值是什么( )
int count = 1;
for (int i = 1; i <= 5; i++) {
count += i;
}
System.out.println(count);
A、5 B、1 C、15 D、16
6、定义一个类,必须使用的关键字是( )
A、public B、class C、interface D、static
7、定义一个接口必须使用的关键字是( )
A、public B、class C、interface D、static
8、如果容器组件 p 的布局是 BorderLayout,则在 p 的下边中添加一个按钮 b,
应该使用的语句是( )
A、p.add(b); B、p.add(b,"North");
C、p.add(b,"South"); D、b.add(p,"North");
9、声明并创建一个按钮对象 b,应该使用的语句是( )
A、Button b=new Button(); B、button b=new button();
C、Button b=new b(); D、b.setLabel(“确定”);
10、Frame 对象默认的布局管理器是( )
A、FlowLayout B、BorderLayout
C、CardLayout D、null
评论0