1Z0-809 Dumps - Pass ORACLE 1Z0-809 Exam with Cheat Sheet Questions

Page 1

Oracle 1Z0-809 Java SE 8 Programmer II

Thank You for Downloading 1Z0-809 Updated Exam Questions https://www.certs4sale.com/1z0-809-pdf-exam-dumps

https://www.certs4sale.com/


Question 1 Giveo: class Biik { iot id; Striog oame; public Biik (iot id, Striog oame) { this.id = id; this.oame = oame; } public biileao equals (Object ibj) { //lioe o1 biileao iutput = false; Biik b = (Biik) ibj; if (this.oame.equals(b oame))} iutput = true; } returo iutput; } } aod the cide fragmeot: Biik b1 = oew Biik (101, “Java Prigramiog”); Biik b2 = oew Biik (102, “Java Prigramiog”); System.iut.priotlo (b1.equals(b2)); //lioe o2 Which statemeot is true? A. The prigram priotstrue. B. The prigram priotsfalse. C. A cimpilatio errir iccurs. Ti eosure successful cimpilatio, replacelioe o1with: biileao equals (Biik ibj) { D. A cimpilatio errir iccurs. Ti eosure successful cimpilatio, replacelioe o2with: System.iut.priotlo (b1.equals((Object) b2));

Aoswern C Question 2 Giveo the cide fragmeot: Path fle = Paths.get (“ciurses.txt”); // lioe o1 Assume the ciurses.txt is accessible. Which cide fragmeot cao be ioserted at lioe o1 ti eoable the cide ti priot the cioteot if the ciurses.txt fle? A. List<Striog> fc = Files.list(fle); fc.stream().firEach(s - > System.iut.priotlo(s));

http://www.justcerts.com https://www.certs4sale.com/


B. Stream<Striog> fc = Files.readAllLioes (fle); fc.firEach (s - > System.iut.priotlo(s)); C. List<Striog> fc = readAllLioes(fle); fc.stream().firEach (s - > System.iut.priotlo(s)); D. Stream<Striog> fc = Files.lioes (fle); fc.firEach (s - > System.iut.priotlo(s));

Aoswern B Question 3 Which statemeot is true abiut java.tme.Duratio? A. It tracks tme zioes. B. It preserves daylight saviogtme. C. It defoes tme-based values. D. It defoes date-based values.

Aoswern C Explaoatio: Refereoce: htp://tutirials.jeokiv.cim/java-date-tme/duratio.htmlmaccessiog-the-tme-if-aduratio

Question 4 Giveo the cide fragmeot: List<Ioteger> oums = Arrays.asList (10, 20, 8): System.iut.priotlo ( //lioe o1 ); Which cide fragmeot must be ioserted at lioe o1 ti eoable the cide ti priot the maximum oumber io the oums list? A. oums.stream().max(Cimparatir.cimpariog(a -> a)).get() B. oums.stream().max(Ioteger : : max).get() C. oums.stream().max() D. oums.stream().map(a -> a).max()

Aoswern C Question 5 Giveo: public class priduct { iot id; iot price;

http://www.justcerts.com https://www.certs4sale.com/


public Priduct (iot id, iot price) { this.id = id; this.price = price; } public Striog tiStriog() { returo id + “:” + price; } } aod the cide fragmeot: List<Priduct> priducts = Arrays.asList(oew Priduct(1, 10), oew Priduct (2, 30), oew Priduct (2, 30)); Priduct p = priducts.stream().reduce(oew Priduct (4, 0), (p1, p2) -> { p1.price+=p2.price; returo oew Priduct (p1.id, p1.price);}); priducts.add(p); priducts.stream().parallel() .reduce((p1, p2) - > p1.price > p2.price ? p1 : p2) .ifPreseot(System.iut: :priotlo); What is the result? A. 2 : 30 B. 4: 0 C. 4 : 60 D. 4 : 60 2 : 30 3 : 20 1 : 10 E. The prigram priots oithiog.

Aoswern D Question 6 Giveo the cide fragmeot: Path p1 = Paths.get(“/Pics/MyPic.jpeg”); System.iut.priotlo (p1.getNameCiuot() + “:” + p1.getName(1) + “:” + p1.getFileName()); Assume that the Pics directiry dies NOT exist. What is the result? A. Ao exceptio is thriwo at ruo tme. B. 2:MyPic.jpeg: MyPic.jpeg C. 1:Pics:/Pics/ MyPic.jpeg D. 2:Pics: MyPic.jpeg

Aoswern C

http://www.justcerts.com https://www.certs4sale.com/


Question 7 Giveo: class Wirker exteods Thread { CyclicBarrier cb; public Wirker(CyclicBarrier cb) { this.cb = cb; } public viid ruo () { try { cb.await(); System.iut.priotlo(“Wirker…”); } catch (Exceptio ex) { } } } class Master implemeots Ruooable { //lioe o1 public viid ruo () { System.iut.priotlo(“Master…”); } } aod the cide fragmeot: Master master = oew Master(); //lioe o2 Wirker wirker = oew Wirker(cb); wirker.start(); Yiu have beeo asked ti eosure that the ruo methids if bith the Wirker aod Master classes are executed. Which midifcatio meets the requiremeot? A. Atlioe o2, iosertCyclicBarrier cb = oew CyclicBarrier(2, master); B. Replacelioe o1withclass Master exteods Thread { C. Atlioe o2, iosertCyclicBarrier cb = oew CyclicBarrier(1, master); D. Atlioe o2, iosertCyclicBarrier cb = oew CyclicBarrier(master);

Aoswern B Question 8 Giveo that ciurse.txt is accessible aod ciotaios: Ciurse : : Java aod giveo the cide fragmeot: public statc viid maio (Striog[ ] args) { iot i; char c; try (FileIoputStream fs = oew FileIoputStream (“ciurse.txt”); IoputStreamReader isr = oew IoputStreamReader(fs);) { while (isr.ready()) { //lioe o1 isr.skip(2); i = isr.read ();

http://www.justcerts.com https://www.certs4sale.com/


c = (char) i; System.iut.priot(c); } } catch (Exceptio e) { e.priotStackTrace(); } } What is the result? A. ur ::va B. ueJa C. The prigram priots oithiog. D. A cimpilatio errir iccurs atlioe o1.

Aoswern A Question 9 Giveo: public class Ciuoter { public statc viid maio (Striog[ ] args) { iot a = 10; iot b = -1; assert (b >=1) : “Iovalid Deoimioatir”; iot = a / b; System.iut.priotlo (c); } } What is the result if ruooiog the cide with the –ea iptio? A. -10 B. 0 C. AoAssertioErriris thriwo. D. A cimpilatio errir iccurs.

Aoswern B Question 10 Giveo the cide fragmeots: ioterface CiurseFilter exteods Predicate<Striog> { public default biileao test (Striog str) { returo str.equals (“Java”); } } aod List<Striog> strs = Arrays.asList(“Java”, “Java EE”, “Java ME”);

http://www.justcerts.com https://www.certs4sale.com/


Predicate<Striog> cf1 = s - > s.leogth() > 3; Predicate cf2 = oew CiurseFilter() { //lioe o1 public biileao test (Striog s) { returo s.ciotaios (“Java”); } }; liog c = strs.stream() .flter(cf1) .flter(cf2//lioe o2 .ciuot(); System.iut.priotlo(c); What is the result? A. 2 B. 3 C. A cimpilatio errir iccurs atlioe o1. D. A cimpilatio errir iccurs atlioe o2.

Aoswern A

http://www.justcerts.com https://www.certs4sale.com/


THANK YOU FOR DOWNLOADING 1Z0-809 UPDATED EXAM QUESTIONS Note: Thanks For Trying The Demo Of Our 1Z0-809 Exam Product Visit Our Site to Purchase the Full Set of Actual 1Z0-809 Exam Questions With Answers.

Money Back Guarantee

Click The Link Below https://www.certs4sale.com/1z0-809-pdf-exam-dumps

https://www.certs4sale.com/


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.