1Z0-809 Exam Questions
277 real 1Z0-809 exam questions with expert-verified answers and explanations. Page 6 of 6.
- Question #251
What is the result? ```java try { new Game().play(); } catch (Exception e) { System.out.print(e.getClass()); } ```
- Question #252
What is true about the java.sql.Statement interface?
- Question #253
Given that data.txt and alldata.txt are accessible, and the code fragment: ```java public void writeFiles() throws IOException { BufferedReader br = new BufferedReader(new FileRead...
- Question #254
Given: ```java class Student { String course, name, city; public Student(String name, String course, String city) { this.course = course; this.name = name; this.city = city; } publ...
- Question #255
Given: ```java class Counter extends Thread { int i = 10; public synchronized void display(Counter obj) { try { Thread.sleep(5); obj.increment(this); System.out.println(i); } catch...
- Question #256
Given the definition of the Employee class: ```java class Employee { String dept, name; public Employee(String d, String n) { dept = d; name = n; } public String toString() { retur...
- Question #257
Given: ```java 1. class MyClass implements Runnable { 2. public int value; 3. public void run() { 4. while (value < 100) { 5. value++; 6. System.out.println("value: " + value); 7....
- Question #258
MyThread mt = new MyThread(); Thread t1 = new Thread(mt); Thread t2 = new Thread(mt); t1.start(); t2.start(); The threads t1 and t2 execute asynchronously and possibly prints ABCA...
- Question #259
Given that these files exist and are accessible: /sports/info.txt /sports/cricket/players.txt /sports/cricket/data/tst.txt and given the code fragment: int maxDepth =2; Stream<Path...
- Question #260
Given: class FuelNotAvailException extends Exception { } class Vehicle { void ride() throws FuelNotAvailException { //line n1 System.out.println("Happy Journey!"); } } class SolarV...
- Question #261
Given: public class Counter { public static void main (String[] args) { int a = 10; int b = 1; assert (b >=-1) : "Invalid Denominator"; int c = a / b; System.out.println (c); } } W...
- Question #262
Given records from the Player table: PID PName 1 Dave 2 Jack 3 Sam and given the code fragment: try { Connection conn = DriverManager.getConnection(URL, username, password); Statem...
- Question #263
Given the code fragments: interface CourseFilter extends Predicate<String> { public default boolean test (String str) { return str.contains ("Java"); } } List<String> strs = Arrays...
- Question #264
Given: public class Foo<K, V> { private K key; private V value; public Foo(K key, V value) { this.key = key; this.value = value; } public static <T> Foo<T, T> twice(T value) { retu...
- Question #265
System.out.println(books); What is the result?
- Question #266
Given the content of Operator.java, EngineOperator.java, and Engine.java files: Operator.java: public abstract class Operator { protected void turnON(); protected void turnOFF(); }...
- Question #267
Given the code fragment: if (aFile.isDirectory ()) { recDelete (aFile.getAbsolutePath ()); } else { if (aFile.getName ().endsWith (".class")) aFile.delete (); } Assume that Project...
- Question #268
Given the code fragments: class ThreadRunner implements Runnable { public void run () { System.out.print ("Runnable"); } } class ThreadCaller implements Callable { public String ca...
- Question #269
Given the code fragment: List<Double> doubles = Arrays.asList (100.12, 200.32); doubles.parallelStream().forEach (d -> System.out.print (d)); doubles.stream().forEach (e -> System....
- Question #270
Given the EMPLOYEE table: EMP_ID | EMP_NAME -------|--------- 100 | Tom 101 | Mary 102 | Peter 103 | Robin Given the code fragment: try (Connection con = DriverManager.getConnectio...
- Question #271
Given the code fragment: List<String> codes = Arrays.asList ("B", "C", "A", "D"); codes.parallelStream().forEach (s -> System.out.print (s)); System.out.println (""); codes.paralle...
- Question #272
Given the information: Emp table has 10 records. Given the code fragment: try (Connection con = DriverManager.getConnection ("Connection_String")); { Statement stmt = con.createSta...
- Question #273
class Bird { String name; Bird(String name) { this.name = name; } public void eat () { System.out.println(name + " is eating"); } } interface BirdInt { Bird getBird(String name); }...
- Question #274
QUESTION 298 Given: public class Emp { public void calcLeave() { System.out.println("12"); } } and the code fragment: public class TestAnn { public static void main (String[] args)...
- Question #275
QUESTION 299 Given the code fragment: List<String> str = Arrays.asList("pen", "is", "not", "a", "pencil"); if (name.length () < 60) { throw new UserException (); } else if (age > 6...
- Question #276
QUESTION 301 Given class UserException extends Exception { } class AgeOutOfLimitException extends UserException { } and the code fragment: public class App { public static void doR...
- Question #277
QUESTION 302 Given the code fragment: public class Foo { public static void main (String [ ] args) { Map<Integer, String> unsortMap = new HashMap< > ( ); unsortMap.put (10, "z"); u...