Java SE 11 Developer v1.0 (1z0-819)

Page:    1 / 12   
Total 177 questions

Given:



and



and



and



What needs to change to make these classes compile and still handle all types of Interface Worker?

  • A. Replace Line 3 with public void addProcess (Worker w) {.
  • B. Replace Line 1 with public class Main extends Thread {.
  • C. Replace Line 2 with private List processes = new ArrayList<>();.
  • D. Replace Line 3 with public void addProcess(T w) {.


Answer : D

Given:



What is the output?

  • A. Short value 25
  • B. The compilation fails due to an error in line 1.
  • C. Byte value 25
  • D. Object value 25


Answer : B

Given:



You replace the code on line 1 to use ParallelStream.

Which one is correct?

  • A. The code will produce the same result.
  • B. The compilation fails.
  • C. A NoSuchElementException is thrown at run time.
  • D. The code may produce a different result.


Answer : D

Given:



You want to implement the java.io.Serializable interface to the MyPersistenceData class.

Which method should be overridden?

  • A. the readExternal method
  • B. nothing
  • C. the readExternal and writeExternal method
  • D. the writeExternal method


Answer : C

Given:



and



and



Which three are correct? (Choose three.)

  • A. f2.foo(li) prints Hola Mundo!
  • B. b1.foo(li) prints Bonjour le monde!
  • C. b1.foo(li) prints Hello world!
  • D. f1.foo(li) prints Bonjour le monde!
  • E. f2.foo(li) prints Hello world!
  • F. f2.foo(li) prints Bonjour le monde!
  • G. f1.foo(li) prints Hola Mundo!
  • H. b1.foo(li) prints Hola Mundo!
  • I. f1.foo(li) prints Hello world!


Answer : A, C, I

Given the code fragment:



What is the result?

  • A. 10
  • B. 1
  • C. The compilation fails at line 9.
  • D. The compilation fails at line 16.
  • E. The compilation fails at line 13.


Answer : E

Given this enum declaration:



Examine this code:

System.out.println(Alphabet.getFirstLetter());

What code should be written at line 3 to make this code print A?

  • A. static String getFirstLetter() { return Alphabet.values()[1].toString();
  • B. static String getFirstLetter() { return A.toString(); }
  • C. final String getFirstLetter() { return A.toString(); }
  • D. String getFirstLetter() { return A.toString(); }


Answer : D

Given the code fragment:



What is the result?

  • A. 5
  • B. 11
  • C. 15
  • D. 21
  • E. 23


Answer : D

Given the declaration:

@inteface Resource {
String[] value();
}

Examine this code fragment:

/* Loc1 */ class ProcessOrders { ... }

Which two annotations may be applied at Loc1 in the code fragment? (Choose two.)

  • A. @Resource({“Customer1”, “Customer2”})
  • B. @Resource(value={{}})
  • C. @Resource
  • D. @Resource(“Customer1”)
  • E. @Resource()


Answer : AD

Given:

public interface Builder {
public A build(String str);
}

and



Assuming that this code compiles correctly, which three statements are true? (Choose three.)

  • A. A cannot be abstract.
  • B. A cannot be final.
  • C. B cannot be abstract.
  • D. B cannot be final.
  • E. B is a subtype of A.
  • F. A is a subtype of B.


Answer : ABD

Given:



What is the output?

  • A. 1 2 [1, 2, 3, four] 3 four
  • B. 1 2 [1, 2, 3, 4] 3 4
  • C. 1 2 [1, 2, 3, 4] 3 four
  • D. 1 2 [1, 2, 3, four] 3 4


Answer : B

Given the code fragment:



Which can replace line 2?

  • A. UnaryOperator u = (int i) -> i * 2;
  • B. UnaryOperator u = (var i) -> (i * 2);
  • C. UnaryOperator u = var i -> { return i * 2; };
  • D. UnaryOperator u = i -> { return i * 2);


Answer : B

Given the content from lines.txt:


C -
C++

Java -

Go -

Kotlin -

and



What is the result?

  • A. C
    C++
    Go
    Kotlin
  • B. JAVA
  • C. C
    C++
    GO
    KOTLIN
  • D. C
    C++
    JAVA
    GO
    KOTLIN


Answer : D

Given:



What is the result?

  • A. 1 2 followed by an exception
  • B. 1 2 4 5
  • C. A ConcurrentModificationException is thrown at run time.
  • D. 1 2 3 followed by an exception


Answer : C

Given:



Which change would make Foo more secure?

  • A. public String beta = "beta";
  • B. public static final String ALPHA = "alpha";
  • C. private String delta;
  • D. protected final String beta = "beta";


Answer : C

Page:    1 / 12   
Total 177 questions