Weekend Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: Board70

1z0-809 Exam Dumps - Oracle Java SE Questions and Answers

Question # 14

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.

Buy Now
Question # 15

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.

Buy Now
Question # 16

For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)

Options:

A.

Time

B.

Date

C.

Statement

D.

ResultSet

E.

Connection

F.

SQLException

G.

DriverManager

Buy Now
Question # 17

Given:

class CheckClass {

public static int checkValue (String s1, String s2) {

return s1 length() – s2.length();

}

}

and the code fragment:

String[] strArray = new String [] {“Tiger”, “Rat”, “Cat”, “Lion”}

//line n1

for (String s : strArray) {

System.out.print (s + “ “);

}

Which code fragment should be inserted at line n1 to enable the code to print Rat Cat Lion Tiger?

Options:

A.

Arrays.sort(strArray, CheckClass : : checkValue);

B.

Arrays.sort(strArray, (CheckClass : : new) : : checkValue);

C.

Arrays.sort(strArray, (CheckClass : : new).checkValue);

D.

Arrays.sort(strArray, CheckClass : : new : : checkValue);

Buy Now
Question # 18

Given:

What is the result?

Options:

A.

Hi Interface-2

B.

A compilation error occurs.

C.

Hi Interface-1

D.

Hi MyClass

Buy Now
Question # 19

Given the code fragment:

UnaryOperator uo1 = s -> s*2;line n1

List loanValues = Arrays.asList(1000.0, 2000.0);

loanValues.stream()

.filter(lv -> lv >= 1500)

.map(lv -> uo1.apply(lv))

.forEach(s -> System.out.print(s + “ “));

What is the result?

Options:

A.

4000.0

B.

4000

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Question # 20

The data.doc, data.txt and data.xml files are accessible and contain text.

Given the code fragment:

Stream paths = Stream.of (Paths. get(“data.doc”),

Paths. get(“data.txt”),

Paths. get(“data.xml”));

paths.filter(s-> s.toString().endWith(“txt”)).forEach(

s -> {

try {

Files.readAllLines(s)

.stream()

.forEach(System.out::println); //line n1

} catch (IOException e) {

System.out.println(“Exception”);

}

}

);

What is the result?

Options:

A.

The program prints the content of data.txt file.

B.

The program prints:Exception<<The content of the data.txt file>>Exception

C.

A compilation error occurs at line n1.

D.

The program prints the content of the three files.

Buy Now
Question # 21

Assume customers.txt is accessible and contains multiple lines.

Which code fragment prints the contents of the customers.txt file?

Options:

A.

Stream stream = Files.find (Paths.get (“customers.txt”));stream.forEach((String c) -> System.out.println(c));

B.

Stream stream = Files.find (Paths.get (“customers.txt”));stream.forEach( c) -> System.out.println(c));

C.

Stream stream = Files.list (Paths.get (“customers.txt”));stream.forEach( c) -> System.out.println(c));

D.

Stream lines = Files.lines (Paths.get (“customers.txt”));lines.forEach( c) -> System.out.println(c));

Buy Now
Question # 22

Given the code fragment:

What is the result?

Options:

A.

A compilation error occurs at line n1.

B.

Logged out at: 2015-01-12T21:58:19.880Z

C.

Can’t logout

D.

Logged out at: 2015-01-12T21:58:00Z

Buy Now
Question # 23

Given:

class Student {

String course, name, city;

public Student (String name, String course, String city) {

this.course = course; this.name = name; this.city = city;

}

public String toString() {

return course + “:” + name + “:” + city;

}

public String getCourse() {return course;}

public String getName() {return name;}

public String getCity() {return city;}

and the code fragment:

List stds = Arrays.asList(

new Student (“Jessy”, “Java ME”, “Chicago”),

new Student (“Helen”, “Java EE”, “Houston”),

new Student (“Mark”, “Java ME”, “Chicago”));

stds.stream()

.collect(Collectors.groupingBy(Student::getCourse))

.forEach(src, res) -> System.out.println(scr));

What is the result?

Options:

A.

A compilation error occurs.

B.

Java EEJava ME

C.

[Java EE: Helen:Houston][Java ME: Jessy:Chicago, Java ME: Mark:Chicago]

D.

[Java ME: Jessy:Chicago, Java ME: Mark:Chicago][Java EE: Helen:Houston]

Buy Now
Exam Code: 1z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Feb 23, 2025
Questions: 196
1z0-809 pdf

1z0-809 PDF

$25.5  $84.99
1z0-809 Engine

1z0-809 Testing Engine

$28.5  $94.99
1z0-809 PDF + Engine

1z0-809 PDF + Testing Engine

$40.5  $134.99