单选题 Which is a valid identifier?()
false
default
_object
a-class
单选题 Which code fragment, inserted at line 23, allows the code to compile?()
df = new DateFormat();
df = Date.getFormat();
df = date.getFormat();
df = DateFormat.getFormat();
df = DateFormat.getInstance();
单选题 System.out.format(”Pi is approximately %d.”, Math.PI); What is the result?()
Compilation fails.
Pi is approximately 3.
Pi is approximately 3.141593.
An exception is thrown at runtime.
多选题 Which two methods, inserted individually, correctly complete the Three class?()
public void foo(){ }
public int foo(){return 3;}
public Two foo(){return this;}
public One foo(){return this;}
public Object foo(){return this;}
单选题 You want to limit access to a method of a public class to members of the same class. Which access accomplishes this objective?()
public
private
protected
transient
default access
单选题 public class Foo { public void main (String args) { system.out.printIn(“Hello World.”); } } What is the result? ()
An exception is thrown.
The code does no compile.
“Hello World.” Is printed to the terminal.
The program exits without printing anything.
单选题 byte arry1, array2; byte array3 ; byte array4; If each array has been initialized, which statement will cause a compiler error?()
Array2 = array1;
Array2 = array3;
Array2 = array4;
Both A and B
Both A and C
Both B and C
多选题 Which two of statements are true?()
It is possible to synchronize static methods.
When a thread has yielded as a result of yield(), it releases its locks.
When a thread is sleeping as a result of sleep(), it releases its locks.
The Object.wait() method can be invoked only from a synchronized context.
The Thread.sleep() method can be invoked only from a synchronized context.
When the thread scheduler receives a notify() request, and notifies a thread, that thread immediately releases its lock.
多选题 public class MethodOver { private int x, y; private float z; public void setVar(int a, int b, float c){ x = a; y = b; z = c; } } Which two overload the setVar method?()
void setVar (int a, int b, float c){ x = a; y = b; z = c; }
public void setVar(int a, float c, int b) { setVar(a, b, c); }
public void setVar(int a, float c, int b) { this(a, b, c); }
public void setVar(int a, float b){ x = a; z = b; }
public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }
单选题 public class CreditCard { private String cardlD; private Integer limit; public String ownerName; public void setCardlnformation(String cardlD, String ownerName, 28. Integer limit) { this.cardlD = cardlD; this.ownerName = ownerName; this.limit = limit; } } Which is true?()
The class is fully encapsulated.
The code demonstrates polymorphism.
The ownerName variable breaks encapsulation.
The cardlD and limit variables break polymorphism.
The setCardlnformation method breaks encapsulation.