public class X {
public static void main (Stringargs) {
String s1 = new String (“true”);
Boolean b1 = new Boolean (true);
if (s2.equals(b1)) {
System.out.printIn(“Equal”);
}
}
}
What is the result? ()
A. The program runs and prints nothing.
B. The program runs and prints “Equal”
C. An error at line 5 causes compilation to fail.
D. The program runs but aborts with an exception.
您可能感兴趣的试卷
你可能感兴趣的试题
String foo = “blue”;
Booleanbar = new Boolean [1];
if (bar[0]) {
foo = “green”;
}
What is the result?()
A. Foo has the value of “”
B. Foo has the value of null.
C. Foo has the value of “blue”
D. Foo has the value of “green”
E. An exception is thrown.
F. The code will not compile.
A. Char ch = “a”;
B. Char ch = ‘“‘ ‘;
C. Char ch = ‘cafe‘;
D. Char ch = “cafe”;
E. Char ch = ‘“ucafe‘;
F. Char ch = ‘“u10100‘;
G. Char ch = (char) true;
Given: 310-025
Leading the way in IT testing and certification tools, www.testking.com
- 48 -
public class foo {
static String s;
public static void main (Stringargs) {
system.out.printIn (“s=” + s);
}
}
What is the result?()
A. The code compiles and “s=” is printed.
B. The code compiles and “s=null” is printed.
C. The code does not compile because string s is not initialized.
D. The code does not compile because string s cannot be referenced.
E. The code compiles, but a NullPointerException is thrown when toString is called.
public interface Foo{
int k = 4;
}
Which three are equivalent to line 2? ()
A. Final int k = 4;
B. Public int k = 4;
C. Static int k = 4;
D. Private int k = 4;
E. Abstract int k = 4;
F. Volatile int k = 4;
G. Transient int k = 4;
H. Protected int k = 4;
int index = 1;
String test = new String;
String foo = test[index];
What is the result?()
A. Foo has the value “”
B. Foo has the value null
C. An exception is thrown
D. The code will not compile
public class Test {
public static void main (Stringargs) {
String foo = args[1];
String bar = args;
String baz = args;
System.out.printIn(“baz = ” + baz);
}
}
And the output: Baz = 2
Which command line invocation will produce the output?()
A. Java Test 2222
B. Java Test 1 2 3 4
C. Java Test 4 2 4 2
D. Java Test 4 3 2 1
package foo;
import java.util.Vector;
private class MyVector extends Vector {
int i = 1;
public MyVector() {
i = 2;
}
}
public class MyNewVector extends MyVector {
public MyNewVector () {
i = 4;
}
public static void main (String args ) {
MyVector v = new MyNewVector();
}
}
The file MyNewVector.java is shown in the exhibit. What is the result?()
A. Compilation will succeed.
B. Compilation will fail at line 5.
C. Compilation will fail at line 6.
D. Compilation will fail at line 14.
E. Compilation will fail at line 17.
A. false
B. default
C. _object
D. a-class
A. New BufferedInputStream(“in.txt”);
B. New BufferedInputStream(new File(“in.txt”));
C. New BufferedInputStream(Writer(“in.txt”));
D. New BufferedInputStream(new Writer(“in.txt”));
E. New BufferedInputStream(new InputStream(“in.txt”));
F. New BufferedInputStream(new FileInputStream(“in.txt”));
A. OutputStream out=new FileOutputStream(“file.txt”);
B. OutputStream out=new FileOutputStream(“file.txt”, “append”);
C. FileOutputStream out=new FileOutputStream(“file.txt”, true);
D. FileOutputStream out=new FileOutputStream(new file(“file.txt”));
E. OutputStream out=new FileOutputStream(new File(“file.txt”)true);
最新试题
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 three changes should be made to adapt this class to be used safely by multiple threads?()
What is the result?()
What is the result?()
Which statement is true about the set variable on line 12?()
What is the result?()
Which statement is true?()
What is the result?()
A programmer must create a generic class MinMax and the type parameter of MinMax must implement Comparable. Which implementation of MinMax will compile?()
Which two of statements are true?()