What is the result?()
A.23
B.234
C.235
D.2345
E.2357
F.Compilation fails.
您可能感兴趣的试卷
你可能感兴趣的试题
What is the result as follows?()
A.5,6
B.5,5
C.6,5
D.6,6
What is the result when the go() method is invoked?()
A.00
B.0001
C.000120
D.00012021
E.Compilation fails.
F.An exception is thrown at runtime.
What is the result?()
A.2
B.3
C.1,2
D.2,3
E.1,2,3
What is the output?()
A.42
B.420
C.462
D.42042
Which two statements are true?()
A.Line 35 will not compile.
B.Line 36 will not compile.
C.Line 37 will not compile.
D.Line 38 will not compile.
public class ClassA {
public int getValue() {
int value=0;
boolean setting = true;
String title=”Hello”;
(value || (setting && title == “Hello”)) { return 1; }
(value == 1 & title.equals(”Hello”)) { return 2; }
}
}
And:
ClassA a = new ClassA();
a.getValue();
What is the result?()
A. 1
B. 2
C. Compilation fails.
D. The code runs with no output.
E. An exception is thrown at runtime.
String[] elements = { “for”, “tea”, “too” };
String first = (elements.length > 0)? elements[0] null;
What is the result?()
A. Compilation fails.
B. An exception is thrown at runtime.
C. The variable first is set to null.
D. The variable first is set to elements[0].
11. class Cup { }
12. class PoisonCup extends Cup { }
21. public void takeCup(Cup c) {
22. if(c instanceof PoisonCup) {
23. System.out.println(”Inconceivable!”);
24. } else if(c instanceof Cup) {
25. System.out.println(”Dizzying intellect!”);
26. } else {
27. System.exit(0);
28. }
29. }
And the execution of the statements:
Cup cup = new PoisonCup();
takeCup(cup);
What is the output?()
A. Inconceivable!
B. Dizzying intellect!
C. The code runs with no output.
D. An exception is thrown at runtime.
E. Compilation fails because of an error in line 22.
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.
public static void test(String str) {
int check = 4;
if (check = str.length()) {
System.out.print(str.charAt(check -= 1) +“, “);
} else {
System.out.print(str.charAt(0) + “, “);
}
}
and the invocation:
test(”four”);
test(”tee”);
test(”to”);
What is the result?()
A. r, t, t,
B. r, e, o,
C. Compilation fails.
D. An exception is thrown at runtime.
最新试题
A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
What is the result?()
What is the result?()
Which statement is true?()
Which two can be results?()
Given: foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait(). From another thread, what provides the most reliable way to ensure that foo will stop executing wait()?()
A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()
Which statement is true?()
What is the result?()
What is the result?()