Valentine Day Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: bigdisc65

Full Access Oracle 1z0-809 Tutorials

Page: 3 / 7
Question 12

Given the code fragment:

What is the result?

Options:

A.

Word: why what when

B.

Word: why Word: why what Word: why what when

C.

Word: why Word: what Word: when

D.

Compilation fails at line n1.

Question 13

Given the code fragment:

public static void main (String [ ] args) throws IOException {

BufferedReader br = new BufferedReader (new InputStremReader (System.in));

System.out.print (“Enter GDP: “);

//line 1

}

Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?

Options:

A.

int GDP = Integer.parseInt (br.readline());

B.

int GDP = br.read();

C.

int GDP = br.nextInt();

D.

int GDP = Integer.parseInt (br.next());

Question 14

Given:

class Vehicle {

int vno;

String name;

public Vehicle (int vno, String name) {

this.vno = vno,;

this.name = name;

}

public String toString () {

return vno + “:” + name;

}

}

and this code fragment:

Set vehicles = new TreeSet <> ();

vehicles.add(new Vehicle (10123, “Ford”));

vehicles.add(new Vehicle (10124, “BMW”));

System.out.println(vehicles);

What is the result?

Options:

A.

10123 Ford10124 BMW

B.

10124 BMW10123 Ford

C.

A compilation error occurs.

D.

A ClassCastException is thrown at run time.

Question 15

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?

Options:

A.

The program prints:Run RunnerCall Caller : nullAnd the program does not terminate.

B.

The program terminates after printing:Run RunnerCall Caller : Run

C.

A compilation error occurs at line n1.

D.

An Execution is thrown at run time.

Page: 3 / 7
Exam Code: 1z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Feb 26, 2024
Questions: 196
1z0-809 pdf

1z0-809 PDF

$28  $80
1z0-809 Engine

1z0-809 Testing Engine

$33.25  $95
1z0-809 PDF + Engine

1z0-809 PDF + Testing Engine

$45.5  $130