有些题目我翻译的可能不是很准确,希望大家解答的同时给于翻译。还有大家会哪个就答哪个,我们可以在一起讨论,我相信群众中蕴藏着大智慧。
(1)Which statement is true?
下面哪种说法是正确的?
A. Memory is reclaimed by calling Runtime.gc(). 调用Runtime.gc()方法时内存会被回收。
B. Objects are not collected if they are accessible from live threads. 存活的线程中的对象是不会被回收的。
C. Objects that have finalize() methods are never garbage collected. 对象调用finalize()方法绝对不被垃圾回收。
D. Objects that have finalize() methods always have their finalize() methods called before
the program ends. 类的finalize()方法总是在程序结束以前被调用。
E. An OutOfMemory error is only thrown if a single block of memory cannot be found
that is large enough for a particular requirement.
(2)
1. class A {
2. A() { }
3. }
4.
5. class B extends A {
6. }
Which two statements are true? (Choose two)
哪两个说法是正确的?
A. Class B’s constructor is public. 类B的构造方法是公有的。
B. Class B’s constructor has no arguments. 类B的构造方法
C. Class B’s constructor includes a call to this().
D. Class B’s constructor includes a call to super().
(3)
You want a class to have access to members of another class in the same package. Which
is the most restrictive access that accomplishes this objective?
你在一个包中让一个类去访问另一个类的成员。哪一种最能达到限制访问的目的?
A. public
B. private
C. protected
D. transient
E. default access
(4)
Which statement is true?
哪一个说法是正确的?
A. Assertions can be enabled or disabled on a class-by-class basis.
B. Conditional compilation is used to allow tested classes to run at full speed.
C. Assertions are appropriate for checking the validity of arguments in a method.
D. The programmer can choose to execute a return statement or to throw an exception if
an assertion fails.