网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
public class X { public object m () { object o = new float (3.14F); object oa = new object [1]; oa[0]= o; o = null; oa[0] = null; return o; } } When is the float object created in line 3, eligible for garbage collection?()
A
Just after line 5.
B
Just after line 6.
C
Just after line 7.
D
Just after line 8(that is, as the method returns).
参考答案
参考解析
解析:
暂无解析
更多 “单选题public class X { public object m () { object o = new float (3.14F); object oa = new object [1]; oa[0]= o; o = null; oa[0] = null; return o; } } When is the float object created in line 3, eligible for garbage collection?()A Just after line 5.B Just after line 6.C Just after line 7.D Just after line 8(that is, as the method returns).” 相关考题
考题
单选题Which method in the Thread class is used to create and launch a new thread of execution?()A
ensp;Run();B
ensp;Start();C
ensp;Execute();D
ensp;Run(Runnableensp;r);E
ensp;Start(Runnableensp;r);F
ensp;Execute(Threadensp;t);
考题
单选题int x= 10; do { x--; } while(x 10); How many times will line 37 be executed?()A
ten timesB
zero timesC
one to me timesD
more than ten times
考题
单选题public class X { public static void main (String args) { byte b = 127; byte c = 126; byte d = b + c; } } Which statement is true?()A
Compilation succeeds and d takes the value 253.B
Line 5 contains an error that prevents compilation.C
Line 5 throws an exception indicating “Out of range”D
Line 3 and 4 contain error that prevent compilation.E
The compilation succeeds and d takes the value of 1.
考题
单选题10. interface Foo {} 11. class Alpha implements Foo {} 12. class Beta extends Alpha {} 13. class Delta extends Beta { 14. public static void main( String[] args) { 15. Beta x = new Beta(); 16. // insert code here 17. } 18. } Which code, inserted at line 16, will cause a java.lang.ClassCastException?()A
Alpha a = x;B
Foo f= (Delta)x;C
Foo f= (Alpha)x;D
Beta b = (Beta)(Alpha)x;
考题
单选题import java.util.*; class KeyMaster { public int i; public KeyMaster(int i) { this.i = i; } public boolean equals(Object o) { return i == ((KeyMaster)o).i; } public int hashCode() { return i; } } public class MapIt { public static void main(String[] args) { Set set = new HashSet(); KeyMaster k1 = new KeyMaster(1); KeyMaster k2 = new KeyMaster(2); set.add(k1); set.add(k1); set.add(k2); set.add(k2); System.out.print(set.size() + “:”); k2.i = 1; System.out.print(set.size() + “:”); set.remove(k1); System.out.print(set.size() + “:”); set.remove(k2); System.out.print(set.size()); } } What is the result?()A
4:4:2:2B
4:4:3:2C
2:2:1:0D
2:2:0:0E
2:1:0:0F
2:2:1:1G
4:3:2:1
考题
单选题You want a class to have access to members of another class in the same package. Which is the most restrictive access modifier that will accomplish that will accomplish this objective?()A
PublicB
PrivateC
ProtectedD
TransientE
No access modifier is required.
考题
单选题10. class Line { 11. public class Point { public int x,y; } 12. public Point getPoint() { return new Point(); } 13. } 14. class Triangle { 15. public Triangle() { 16. // insert code here 17. } 18. } Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()A
Point p = Line.getPoint();B
Line.Point p = Line.getPoint();C
Point p = (new Line()).getPoint();D
Line.Point p = (new Line()).getPoint();
考题
单选题Under which circumstances will a thread stop?()A
The method waitforId() in class MediaTracker is called.B
The run() method that the thread is executing ends.C
The call to the start() method of the Thread object returns.D
The suspend() method is called on the Thread object.E
The wait() method is called on the Thread object.
考题
多选题public class Foo { private int val; public foo(int v) (val = v;) } public static void main (String args) { Foo a = new Foo (10); Foo b = new Foo (10); Foo c = a; int d = 10; double e = 10.0; } Which three logical expression evaluate to true? ()A(a ==c)B(d ==e)C(b ==d)D(a ==b)E(b ==c)F(d ==10.0)
热门标签
最新试卷