Java SE 11 Developer Questions and Answers
Given:
What is the result?
A)
B)
C)
D)
Given:
String originalPath = “data\\projects\\a-project\\..\\..\\another-project”;
Path path = Paths.get(originalPath);
System.out.print(path.normalize());
What is the result?
Which code fragment prints 100 random numbers?
Given:
What is the result?
Which interface in the java.util.function package will return a void return type?
Given:
And the command:
java Main Helloworld
What is the result ?
Given:
What is the correct definition of the JsonField annotation that makes the Point class compile?
A)
B)
C)
Given:
What code must you insert on Line 1 to enable the code to print Hello world?
Given:
Which two are correct? (Choose two.)
Given:
What is the expected result of javac?
Which is the correct order of possible statements in the structure of a Java class file?
Given:
Which option should you choose to enable the code to print Something happened?
Given:
What is required to make the Foo class thread safe?
A company has an existing sales application using a Java 8 jar file containing packages:
com.company.customer;
com.company.customer.orders;
com.company.customer.info;
com.company.sales;
com.company.sales.leads;
com.company.sales.closed;
com.company.orders;
com.company.orders.pending;
com.company.orders.shipped.
To modularize this jar file into three modules, customer, sales, and orders, which module-info.java would be correct?
A)
B)
C)
D)
Given:
Which statement is true?
Given:
What is the result?
Given:
What must be added in line 1 to compile this class?
Assuming the Widget class has a getPrice method, this code does not compile:
Which two statements, independently, would allow this code to compile? (Choose two.)
Which code is correct?
Given:
It is required that if p instanceof Pair then p.isValid() returns true.
Which is the smallest set of visibility changes to insure this requirement is met?
Which two safely validate inputs? (Choose two.)
Given:
Which two statements are true if the method is added to Bar? (Choose two.)
Given:
What is the result?
Which code fragment compiles?
Given:
Which three are true? (Choose three.)
Given TripleThis.java:
Compiling TripleThis.java gives this compiler warning:
Note: TripleThis.java uses unchecked or unsafe operations.
Which two replacements done together remove this compiler warning?
Given:
Which statement on line 1 enables this code to compile?
Given:
What is the result?
Which interface in the java.util.function package can return a primitive type?
Given:
var data = new ArrayList<>();
data.add(“Peter”);
data.add(30);
data.add(“Market Road”);
data.set(1, 25);
data.remove(2);
data.set(3, 1000L);
System.out.print(data);
What is the output?
Given the code fragment:
What is the result?
Given the content:
What Is the result?
A)
B)
C)
D)
E)
User Username
Given:
What is the result?
A)
B)
C)
D)
Given:
Which is true about line 1?
Given:
What is known about the Sportscar class?
Analyze the code:
Which two options can you insert inside println method to produce Global:namescope? (Choose two.)
Given:
What is the result?