Given: What is the output?
A. Hello world!Bonjour le monde!
B. Hello world!Hello world!
C. Bonjour le monde!Hello world!
D. Bonjour le monde!Bonjour le monde!
Which two var declarations are correct? (Choose two.)
A. var names = new ArrayList<>();
B. var _ = 100;
C. var var = "hello";
D. var y = null;
E. var a;
Given:
What is the result?
A. 2-4
B. 0-6 1-5 2-4
C. 1-5
D. 1-5 2-4
E. The compilation fails due to an error in line 1.
F. 0-6
G. 0-6 2-4
Given the code fragment:
How many lines of text does this program print?
A. four
B. one
C. three
D. two
Given: What must be added in line 1 to compile this class?
A. catch(IOException e) { }
B. catch(FileNotFoundException | IndexOutOfBoundsException e) { }
C. catch(FileNotFoundException | IOException e) { }
D. catch(IndexOutOfBoundsException e) { }catch(FileNotFoundException e) { }
E. catch(FileNotFoundException e) { }catch(IndexOutOfBoundsException e) { }
Which two expressions create a valid Java Path instance? (Choose two.)
A. Paths.get("foo")
B. Paths.getPath("too")
C. Path.get(new URI("file:///domains/oracle/test.txt"))
D. new Path("foo")
E. Paths.get(URL.create("file:///domains/oracle/test.txt"))
Given:
public class X {
}
and
public final class Y extends X {
}
What is the result of compiling these two classes?
A. The compilation fails because there is no zero args constructor defined in class X.
B. The compilation fails because either class X or class Y needs to implement the toString() method.
C. The compilation fails because a final class cannot extend another class.
D. The compilation succeeds.
Which two statements independently compile? (Choose two.)
A. List list = new ArrayList
B. List list = new ArrayList
C. List list = new ArrayList
D. List list = new ArrayList
E. List list = new ArrayList
Which three annotation uses are valid? (Choose three.)
A. Function
B. var v = "Hello" + (@Interned) "World"
C. Function
D. Function
E. var myString = (@NonNull String) str;
F. var obj = new @Interned MyObject();
Given:
What is the result?
A. An indexOutofBoundsException is thrown at runtime.
B. At once 0
C. Hat at store 4
D. At once 1
E. Hat at store 1
Given:
List
list1.add("A");
list1.add("B");
List list2 = List.copyOf(list1);
list2.add("C");
List> list3 = List.of(list1, list2);
System.out.println(list3);
What is the result?
A. [[A, B],[A, B]]
B. An exception is thrown at run time.
C. [[A, B], [A, B, C]]
D. [[A, B, C], [A, B, C]]
Which two safely validate inputs? (Choose two.)
A. Delegate numeric range checking of values to the database.
B. Accept only valid characters and input values.
C. Use trusted domain-specific libraries to validate inputs.
D. Assume inputs have already been validated.
E. Modify the input values, as needed, to pass validation.
Given:
What is known about the Sportscar class?
A. The Sportscar class is a subclass of Automobile and inherits its methods.
B. The Sportscar subclass cannot override setTurbo method from the superclass Automobile.
C. The Sportscar class is a superclass that has more functionality than the Automobile class.
D. The Sportscar class inherits the setTurbo method from the superclass Automobile.
Given the content: What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Given:
What is the result?
A. A java.util.NoSuchElementException is thrown at run time.
B. Ans : a
C. The compilation fails.
D. Ans :