Public class test (
Public static void main (String args[]) (
System.out.printIn (6 ^ 3);
)
)
What is the output?()
您可能感兴趣的试卷
你可能感兴趣的试题
public class test (
private static int j = 0;
private static boolean methodB(int k) (
j += k;
return true;
)
public static void methodA(int i)(
boolean b:
b = i < 10 | methodB (4);
b = i < 10 || methodB (8);
)
public static void main (String args[])(
methodA (0);
system.out.printIn(j);
)
)
What is the result?()
A. The program prints “0”
B. The program prints “4”
C. The program prints “8”
D. The program prints “12”
E. The code does not complete.
Integer i = new Integer (42);
Long 1 = new Long (42);
Double d = new Double (42.0);
Which two expressions evaluate to True?()
A. (i ==1)
B. (i == d)
C. (d == 1)
D. (i.equals (d))
E. (d.equals (i))
F. (i.equals (42)
1.public class test (
2.public static void main (String args[]) {
3.int i = 0xFFFFFFF1;
4.int j = ~i;
5.
6.}
7.)
What is the decimal value of j at line 5?()
A. 0
B. 1
C. 14
D. –15
E. An error at line 3 causes compilation to fail.
F. An error at line 4 causes compilation to fail.
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));
最新试题
What is the result?()
Which statement is true?()
What is the appropriate definition of the hashCode method in class Person?()
Which two of statements are true?()
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?()
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 three changes should be made to adapt this class to be used safely by multiple threads?()
Which statement is true?()