A. 3/2
B. 3<2
C. 3*4
D. 3<<2
E. 3*2^2
F. 3<<<2
您可能感兴趣的试卷
你可能感兴趣的试题
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.
A. false
B. default
C. _object
D. a-class
public class Mycircle {
public double radius;
public double diameter;
public void setRadius(double radius)
this.radius = radius;
this.diameter= radius * 2;
}
public double getRadius() {
return radius;
}
Which statement is true?()
A. The Mycircle class is fully encapsulated.
B. The diameter of a given MyCircle is guaranteed to be twice its radius.
C. Lines 6 and 7 should be in a synchronized block to ensure encapsulation.
D. The radius of a MyCircle object can be set without affecting its diameter.
class BaseClass{
private float x= 1.0f;
protected void setVar (float f) {x = f;}
}
class SubClass extends BaseClass {
private float x = 2.0f;
//insert code here
}
Which two are valid examples of method overriding?()
A. Void setVar(float f) {x = f;}
B. Public void setVar(int f) {x = f;}
C. Public void setVar(float f) {x = f;}
D. Public double setVar(float f) {x = f;}
E. Public final void setVar(float f) {x = f;}
F. Protected float setVar() {x=3.0f; return 3.0f; }
1. class A implements Runnable (
2. int i;
3. public void run () (
4. try (
5. thread.sleep(5000);
6. i= 10;
7. ) catch(InterruptedException e) {}
8. )
9. )
10.
11. public class Test {
12. public static void main (string args[]) (
13. try (
14. A a = new A ();
15. Thread t = new Thread (a);
16. t.start();
17.
18. int j= a.i;
19.
20. ) catch (Exception e) {}
21. )
22. }
Which statement al line 17 will ensure that j=10 at line 19?()
A. a.wait();
B. t.wait();
C. t.join();
D. t.yield();
E. t.notify();
F. a.notify();
G. t.interrupt();
A. Double d = Math.cos(42);
B. Double d = Math.cosine(42);
C. Double d = Math.cos(Math.toRadians(42));
D. Double d = Math.cos(Math.toDegrees(42));
E. Double d = Math.cosine(Math.toRadians(42));
String a = “ABCD”;
String b = a.toLowerCase();
b.replace(‘a’, ‘d’);
b.replace(‘b’, ‘c’);
System.out.println(b);
What is the result? ()
A. abcd
B. ABCD
C. dccd
D. dcba
E. Compilation fails.
F. An exception is thrown at runtime.
A. –2
B. NaN
C. Infinity
D. Compilation fails.
E. An exception is thrown at runtime.
A. java.util.Map
B. java.util.List
C. java.util.Hashable
D. java.util.Collection
最新试题
Which two can be results?()
What can be a result?()
Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()
Which two are possible results?()
Which statement is true?()
What is the output if the main() method is run?()
What is the result?()
What is the result?()
Which statement is true?()
What is the appropriate definition of the hashCode method in class Person?()