Which are most typically thrown by an API developer or an
application developer as opposed to being thrown by the JVM? (Choose all that apply.)
A. ClassCastException
B. IllegalStateException
C. NumberFormatException
D. IllegalArgumentException
E. ExceptionInInitializerError
请选择: A B C D E
答案:B C D
Which declarations of identifiers are legal?
A. $persons
B. TwoUsers
C. *point
D. this
E. _endline
请选择: A B C D E
答案:A B E
点评:Java的标识符可以以一个Unicode字符,下滑线(_),美元符($)开始,后续字符可以是前面的符号和数字,没有长度限制,大小写敏感,不能是保留字。
class BaseClass{
private float x=1.0f;
private float getVar(){return x;}
}
class SubClass extends BaseClass{
private float x=2.0f;
//insert code
}
what are true to override getVar()?
A.float getVar(){
B.public float getVar(){
C.public double getVar(){
D.protected float getVar(){
E.public float getVar(float f){
请选择: A B C D E
答案:A B D
点评:参数列表和返回值以及方法名(好像是费话)必须精确匹配,访问控制要更公有化
Which modifiers and return types would be valid in the declaration of a
working main() method for a Java standalone application?
A) private
B) final
C) static
D) int
E) abstract
请选择: A B C D E
答案:B C
How can you change the break statement below so that it breaks out of both the
inner and middle loops and continues with the next iteration of the outer loop?
outer: for (int x = 0; x < 3; x++) {
middle: for (int y = 0; y < 3; y++) {
inner: for (int z = 0; z < 3; z++) {
if (arr(x, y, z) == targetValue)
break;
} } }
Select the one right answer.
a) break inner;
b) break middle;
c) break outer;
d) continue;
e) continue middle;
请选择: A B C D E
答案:B
Which are not Java keywords?
A. TRUE
B. sizeof
C. const
D. super
E. void
请选择: A B C D E
答案:A B
点评: A:不是,Java中有true,但是这也不是关键字而是字面量(literal)。
B:不是,Java中不需要这个操作符,所有的类型(原始类型)的大小都是固定的。
C、D、E都是,需要说明的是const是java中未被使用的关键字。
Given:
public abstract interface Frobnicate { public void twiddle(String s) ; }
Which is a correct class? (Choose all that apply.)
A. public abstract class Frob implements Frobnicate {
public abstract void twiddle(String s){}
}
B. public abstract class Frob implements Frobnicate { }
C. public class Frob extends Frobnicate {
public void twiddle(Integer i) { }
}
D. public class Frob implements Frobnicate {
public void twiddle(Integer i) { }
}
E. public class Frob implements Frobnicate {
public void twiddle(String i) { }
public void twiddle(Integer s) { }
}
请选择: A B C D E
答案:B E
Which of the following statements is correct for a method which is overriding the
following method:
public void add(int a) {…}
A. the overriding method must return void
B. the overriding method must return int
C. the overriding method can return whatever it likes
Select the most appropriate answer.
请选择: A B C
答案:A
Which are methods of the Object class? (Choose all that apply.)
A. notify();
B. notifyAll();
C. isInterrupted();
D. synchronized();
E. interrupt();
F. wait(long msecs);
G. sleep(long msecs);
请选择: A B C D E F G
答案:A B F
A socket object has been created and connected to a standard internet service on
a remote network server. Which construction give the most suitable means for
reading ASCII data online at a time from the socket?
A. InputStream in=s.getInputStream();
B. DataInputStream in=new DataInputstream(s.getInputStream());
C. ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream());
D. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));
E. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()),”
8859-1”);
请选择: A B C D E
答案:E
点评:在程序中实现字节与字符转换时,采用规范“ISO8859-1”是最适宜的方式。
1) class Super{
2) public float getNum(){return 3.0f;}
3) }
4)
5) public class Sub extends Super{
6)
7) }
which method, placed at line 6, will cause a compiler error?
A. public float getNum(){return 4.0f;}
B. public void getNum(){}
C. public void getNum(double d){}
D. public double getNum(float d){return 4.0d;}
请选择: A B C D
答案:B
1) class Super{
2) public float getNum(){return 3.0f;}
3) }
4)
5) public class Sub extends Super{
6)
7) }
which method, placed at line 6, will cause a compiler error?
A. public float getNum(){return 4.0f;}
B. public void getNum(){}
C. public void getNum(double d){}
D. public double getNum(float d){return 4.0d;}
请选择: A B C D
答案:B
Which of the following statements are true?
A. For a given component events will be processed in the order the listeners are added.
B. Using the Adapter approach to event handling means there is a need to create blank
method bodies for all event methods.
C. A component may have multiple listeners associated with it.
D. Listeners may be removed once added.
请选择: A B C D
答案:C D
点评:没有
Give the following java class:
public class Example{
public static void main(String args[]){
static int x[] = new int[15];
System.out.println(x[5]);
}
}
Which statement is corrected?
A. When compile, some error will occur.
B. When run, some error will occur.
C. Output is zero.
D. Output is null.
请选择: A B C D
答案:A
点评:自动变量不能被static修饰,如果将static关键字去掉,答案选择C。
Which collection class(es) allows you to grow or shrink its size
and provides indexed access to its elements, but whose methods are
not synchronized? (Choose all that apply.)
A. java.util.HashSet
B. java.util.LinkedHashSet
C. java.util.List
D. java.util.ArrayList
E. java.util.Vector
F. java.util.PriorityQueue
请选择: A B C D E F
答案:D
public static synchronized void main(String[] args) throws
InterruptedException {
Thread t = new Thread();
t.start () ;
System.out.print ("X") ;
t.wait (10000) ;
System.out.print("Y");
}
What is the result of this code?
A. It prints X and exits.
B. It prints X and never exits.
C. It prints XY and exits almost immeditately.
D. It prints XY with a 10-second delay between X and Y.
E. It prints XY with a 10000-second delay between X and Y.
F. The code does not compile.
G. An exception is thrown at runtime.
请选择: A B C D E F G
分享到:
相关推荐
1. "java.doc" 可能是一份关于Java测试的文档,可能详细解释了Java测试的基本概念、技术以及如何在实际项目中应用。 2. "~$va笔试题常见英语.doc" 提到了笔试题,这可能是面试或招聘过程中的Java测试题目,其中可能...
【北大青鸟S1 JAVA 选择题50题内部测试】是北大青鸟教育机构为学员准备的一套Java编程语言的精选选择题集,旨在帮助学员巩固和检验S1阶段的学习成果。这套试题涵盖了一小时的限时测试,旨在锻炼学员在实际考试环境中...
Java是一种广泛使用的面向对象的编程语言,特别是在企业级应用开发中。这些测试题目涉及了Java的基础知识,Swing图形用户界面(GUI)组件,数据库连接和操作,以及事件处理等核心概念。 1. 流式布局管理器...
本套自测题集是专为Java编程语言设计的,涵盖了数据结构的基础到高级主题,适合计算机专业的在校学生进行考试复习。以下是各章自测题及详细答案的概述: 1. **数据结构绪论**: 这一部分通常会介绍数据结构的基本...
这是一份针对北大青鸟Y2阶段Java学员的结业测试题,它旨在检验学员在学习完这一阶段课程后对Java编程语言的理解程度和应用能力。这份测试题不仅包含了一系列问题,还附带了源代码,便于学员在解答过程中参考和学习。...
Java测试题 用于检测学习效果的一个小测验!
【Java题库测试】是一个关于Java编程语言的学习资源集合,主要涵盖了各种编程题目,旨在帮助开发者提升Java技术能力。这个题库可能包含了多种类型的题目,如基础语法、面向对象、集合框架、多线程、网络编程、IO流、...
广州传智播客JavaEE工程师测试题(带答案的).doc 应聘时最漂亮的回答.docx 当面试官问「你有什么要问我的吗」时,应该问什么?.docx 提高 Java 代码性能的各种技巧.docx 搜狗商业平台Java技术实践.docx 最新JAVA...
广州传智播客JavaEE工程师测试题(带答案的).doc 应聘时最漂亮的回答.docx 当面试官问「你有什么要问我的吗」时,应该问什么?.docx 提高 Java 代码性能的各种技巧.docx 搜狗商业平台Java技术实践.docx 最新JAVA...
这些面试题通常用于测试开发者对Java基础知识的掌握程度。理解JDK与JRE的区别可以帮助开发者理解开发环境和运行环境的不同需求,而`==`和`equals`的使用则涉及到对Java内存模型的理解,这是编写正确、健壮的Java代码...
Java 测试系统是一种基于Java编程语言开发的软件应用,主要用于进行选择题类型的在线测试。这样的系统通常包含多项功能,如题目库管理、用户界面、答题逻辑以及结果评估等。在这个项目中,我们可以从以下几个关键...
1. **Java语法基础**:测试题可能会包含变量声明、数据类型(如int、char、boolean等)、运算符(算术、比较、逻辑等)、流程控制语句(如if、switch、for、while)等方面的内容。理解这些基本语法是编写任何Java...
Java 技能测试题主要涵盖了三个核心领域:线程、Socket和I/O以及算法和数据库操作。这些知识点在Java编程中至关重要,对于软件工程师的角色尤其重要。以下是对这些知识点的详细解释: 1. **线程**: 线程是程序中...
本文档提供了一个全面的 Java 程序设计考试测试题,涵盖了 Java 基础知识点,可以帮助学习者快速了解 Java 语言的基本概念和编程技术。 知识点: 1. Java 源程序编译后的文件扩展名是.class。 2. Java 中的合法...
Java应用程序-题库测试题练习题带答案测试题模拟题自测题.doc
*测试题 1:冒泡排序 *测试题 2:方法的使用 *测试题 3:数组的遍历 *测试题 4:break 语句的使用 *测试题 5:变量的作用域 *测试题 6:字符串的连接 *测试题 7:变量的交换 *测试题 8:条件运算符的使用 *测试题 9...
2019年Java程序设计教程测试题及答案-测试题一.rar 2019年Java程序设计教程测试题及答案-测试题一.rar 2019年Java程序设计教程测试题及答案-测试题一.rar 2019年Java程序设计教程测试题及答案-测试题一.rar 2019年...