多项选择题

10. public class MyClass { 
11. 
12. public Integer startingI; 
13. public void methodA() { 
14. Integer i = new Integer(25); 
15. startingI = i; 
16. methodB(i); 
17. } 
18. private void methodB(Integer i2) { 
19. i2 = i2.intValue(); 
20. 
21. } 
22. } 
If methodA is invoked, which two are true at line 20?()

A. i2 == startingI returns true.
B. i2 == startingI returns false.
C. i2.equals(startingI) returns true.
D. i2.equals(startingI) returns false.


您可能感兴趣的试卷

你可能感兴趣的试题

2.单项选择题

11. public static void test(String str) { 
12. if(str == null | str.lellgth() == 0) { 
13. System.out.println(”String is empty”); 
14. } else { 
15. System.out.println(”String is not empty”); 
16. } 
17. } 
And the invocation: 
31. test(llull); 
What is the result?() 

A. Au exception is thrown at runtime.
B. “String is empty” is printed to output.
C. Compilation fails because of au error in line 12.
D. “String is not empty” is printed to output.

4.多项选择题

package com.company.application; 
public class MainClass { 
public static void main(String[] args) { } 
} 
And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to “.“ (current directory). 
Which two java commands entered at the command line will run MainClass?()

A. java MainClass if run from the /apps directory
B. java com.company.application.MainClass if run from the /apps directory
C. java -classpath /apps com.company.application.MainClass if run from any directory
D. java -classpath . MainClass if run from the /apps/com/company/application directory
E. java -classpath /apps/com/company/application:. MainClass if run from the /apps directory
F. java com.company.application.MainClass if run from the /apps/com/company/application directory

6.单项选择题

A class games.cards.Poker is correctly defined in the jar file Poker.jar. 
A user wants to execute the main method of Poker on a UNIX system using the command: 
java games.cards.Poker 
What allows the user to do this?() 

A. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java
B. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar
C. Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar
D. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java
E. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuffijava/*.jar
F. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar

8.单项选择题

11. class Snoochy { 
12. Boochybooch; 
13. public Snoochy() { booch = new Boochy(this); } 
14. } 
15. 
16. class Boochy { 
17. Snoochy snooch; 
18. public Boochy(Snoochy s) { snooch = s; } 
19. } 
And the statements: 
21. public static void main(String[] args) { 
22. Snoochy snoog = new Snoochy(); 
23. snoog = null; 
24. // more code here 
25. } 
Which statement is true about the objects referenced by snoog, snooch, and booch immediately after line 23 executes?() 

A. None of these objects are eligible for garbage collection.
B. Only the object referenced by booch is eligible for garbage collection.
C. Only the object referenced by snoog is eligible for garbage collection.
D. Only the object referenced by snooch is eligible for garbage collection.
E. The objects referenced by snooch and booch are eligible for garbage collection.