Given:
class RateOfInterest {
public static void main (String[] args) {
int rateOfInterest = 0;
String accountType = “LOAN”;
switch (accountType) {
case “RD”;
rateOfInterest = 5;
break;
case “FD”;
rateOfInterest = 10;
break;
default:
assert false: “No interest for this account”; //line n1
}
System.out.println (“Rate of interest:” + rateOfInterest);
}
}
and the command:
java –ea RateOfInterest
What is the result?
For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)
Given:
class Worker extends Thread {
CyclicBarrier cb;
public Worker(CyclicBarrier cb) { this.cb = cb; }
public void run () {
try {
cb.await();
System.out.println(“Worker…”);
} catch (Exception ex) { }
}
}
class Master implements Runnable { //line n1
public void run () {
System.out.println(“Master…”);
}
}
and the code fragment:
Master master = new Master();
//line n2
Worker worker = new Worker(cb);
worker.start();
You have been asked to ensure that the run methods of both the Worker and Master classes are executed.
Which modification meets the requirement?
Given the structure of the Student table:
Student (id INTEGER, name VARCHAR)
Given the records from the STUDENT table:
Given the code fragment:
Assume that:
What is the result?
Given:
final class Folder {//line n1
//line n2
public void open () {
System.out.print(“Open”);
}
}
public class Test {
public static void main (String [] args) throws Exception {
try (Folder f = new Folder()) {
f.open();
}
}
}
Which two modifications enable the code to print Open Close? (Choose two.)
Given:
public class Test
private T t;
public T get () {
return t;
}
public void set (T t) {
this.t = t;
}
public static void main (String args [ ] ) {
Test
Test type 1 = new Test ();//line n1
type.set(“Java”);
type1.set(100);//line n2
System.out.print(type.get() + “ “ + type1.get());
}
}
What is the result?
Given the code fragments:
class Caller implements Callable
String str;
public Caller (String s) {this.str=s;}
public String call()throws Exception { return str.concat (“Caller”);}
}
class Runner implements Runnable {
String str;
public Runner (String s) {this.str=s;}
public void run () { System.out.println (str.concat (“Runner”));}
}
and
public static void main (String[] args) InterruptedException, ExecutionException {
ExecutorService es = Executors.newFixedThreadPool(2);
Future f1 = es.submit (new Caller (“Call”));
Future f2 = es.submit (new Runner (“Run”));
String str1 = (String) f1.get();
String str2 = (String) f2.get();//line n1
System.out.println(str1+ “:” + str2);
}
What is the result?
PDF + Testing Engine |
---|
$66 |
Testing Engine |
---|
$50 |
PDF (Q&A) |
---|
$42 |
Oracle Free Exams |
---|
|