Tag Archives: declaration

The protected modifier on a Field declaration within a public class means that the field ______________.

The protected modifier on a Field declaration within a public class means that the field ______________. A. Can be read and written from this class and its subclasses defined in any package B. Can be read but not written from outside the class C. Can be read and written from this class and its subclasses only within the… Read More »

Given this enum declaration: (Exhibit) Examine this code: System.out.println(Alphabet.getFirstLetter());

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 A.toString(); } B. String getFirstLetter() { return A.toString(); } C. static String getFirstLetter() { return Alphabet.values()[1].toString(); } D. final String getFirstLetter() { return A.toString(); } Correct Answer: A

Given this enum declaration: (Exhibit) Examine this code: System.out.println(Letter.values()[1]); What

Given this enum declaration:Examine this code:System.out.println(Letter.values()[1]);What code should be written at line 5 for this code to print 200? A. public String toString() { return String.valueOf(ALPHA.v); } B. public String toString() { return String.valueOf(Letter.values()[1]); } C. public String toString() { return String.valueOf(v); } D. String toString() { return “200”; } Correct Answer: C

Examine this excerpt from the declaration of the java.se module: (Exhibit) What does the transitive modifier

Examine this excerpt from the declaration of the java.se module:What does the transitive modifier mean? A. Any module that requires the java.sql module does not need to require the java.se module. B. Any module that requires the java.se module does not need to require the java.sql module. C. Only a module that requires the java.se module is permitted… Read More »

Given the declaration: (Exhibit) Examine this code fragment: /* Loc1 */ class ProcessOrders { … } Which

Given the declaration:Examine this code fragment:/* Loc1 */ class ProcessOrders { … }Which two annotations may be applied at Loc1 in the code fragment? (Choose two.) A. @Resource(name=”Customer1″, priority=100) B. @Resource(priority=100) C. @Resource D. @Resource(priority=0) E. @Resource(name=”Customer1″) Correct Answer: B,D

Consider this method declaration: (Exhibit) A) "SET SESSION AUTHORIZATION " + user B) "SET SESSION AUTHORIZATION

Consider this method declaration:A) “SET SESSION AUTHORIZATION ” + userB) “SET SESSION AUTHORIZATION ” + stmt.enquoteIdentifier(user)Is A or B the correct replacement for <EXPRESSION> and why? A. B, because all values provided by the calling code should be enquoted. B. A, because it is unnecessary to enclose identifiers in quotes. C. A, because it sends exactly the value… Read More »