Which code fragment does a service use to load the service provider with a Print interface?
A. private Print print = com.service.Provider.getInstance();
B. private java.util.ServiceLoader
C. private java.util.ServiceLoader
D. private Print print = new com.service.Provider.PrintImpl();
You are working on a functional bug in a tool used by your development organization. In your investigation, you find that the tool is executed with a security policy file containing this grant.
What action should you take?
A. Nothing, because it is an internal tool and not exposed to the public.
B. Remove the grant because it is excessive.
C. Nothing, because it is not related to the bug you are investigating.
D. File a security bug against the tool referencing the excessive permission granted.
E. Nothing, because listing just the required permissions would be an ongoing maintenance challenge.
Given:
What action ensures successful compilation?
A. Replace public Color(int c) with private Color(int c).
B. Replace int c; with private int c;.
C. Replace int c; with private final int c;.
D. Replace enum Color implements Serializable with public enum Color.
E. Replace enum Color with public enum Color.
Given: Which statement is equivalent to line 1?
A. double totalSalary = list.stream().map(e -> e.getSalary() * ratio).reduce(bo).ifPresent (p -> p.doubleValue());
B. double totalSalary = list.stream().mapToDouble(e -> e.getSalary() * ratio).sum;
C. double totalSalary = list.stream().map(Employee::getSalary * ratio).reduce(bo).orElse(0.0);
D. double totalSalary = list.stream().mapToDouble(e -> e.getSalary() * ratio).reduce(starts, bo);
Given:
And the command: java Main Helloworld What is the result ?
A. Input: Echo:
B. Input: Helloworld Echo: Helloworld
C. Input: Then block until any input comes from System.in.
D. Input: Echo: Helloworld
E. A NullPointerException is thrown at run time.
Given:
After which line can we insert assert i < 0 || values[i] <= values[i + 1]; to verify that the values array is partially sorted?
A. after line 8
B. after line 6
C. after line 5
D. after line 10
Given:
Which three actions implement Java SE security guidelines? (Choose three.)
A. Change line 7 to return names.clone();.
B. Change line 4 to this.names = names.clone();.
C. Change the getNames() method name to get$Names().
D. Change line 6 to public synchronized String[] getNames() {.
E. Change line 2 to private final String[] names;.
F. Change line 3 to private Secret(String[] names) {.
G. Change line 2 to protected volatile String[] names;.
Consider this method declaration:
A) “SET SESSION AUTHORIZATION “ + user
B) “SET SESSION AUTHORIZATION “ + stmt.enquoteIdentifier(user)
Is A or B the correct replacement for
A. A, because it sends exactly the value of user provided by the calling code.
B. B, because enquoting values provided by the calling code prevents SQL injection.
C. A and B are functionally equivalent.
D. A, because it is unnecessary to enclose identifiers in quotes.
E. B, because all values provided by the calling code should be enquoted.
Given:
What is the result?
A. Orange Juice
B. The compilation fails.
C. Orange Juice Apple Pie Lemmon Ice Raspberry Tart
D. The program prints nothing.