单项选择题
Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done? ()
public class Q76a9 {
static String f() {
String a = "hello";
String b = "bye"; // (0)
String c = b + "!"; // (1)
String d = b; b = a; // (2)
d = a; // (3)
return c; // (4) }
public static void main(String args[]) {
String msg = f();
System.out.println(msg); // (5)
}
}
A.The line marked (1).
B.The line marked (2).
C.The line marked (3).
D.The line marked (4).
E.The line marked (5).
相关考题
-
多项选择题
Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?() public class Q4a39 { int a = 1; int b = 1; int c = 1; class Inner { int a = 2; int get() { int c = 3; // insert statement here return c; } } Q4a39() { Inner i = new Inner(); System.out.println(i.get()); } public static void main(String args[]) { new Q4a39(); } }
A.c = b;
B.c = this.a;
C.c = this.b;
D.c = Q4a39.this.a;
E.c = c; -
单项选择题
HowdoestheweightypropertyoftheGridBagConstraintsobjectsusedingridbaglayoutaffectthelayoutofthecomponents?()
A.It affects which grid cell the components end up in.
B.It affects how the extra vertical space is distributed.
C.It affects the alignment of each component.
D.It affects whether the components completely fill their allotted display area vertically. -
多项选择题
Which lines of code are valid declarations of a native method when occurring within the declaration of the following class?() public class Qf575 { // insert declaration of a native method here }
A.native public void setTemperature(int kelvin);
B.private native void setTemperature(int kelvin);
C.protected int native getTemperature();
D.public abstract native void setTemperature(int kelvin);
E.native int setTemperature(int kelvin) {}
