【正文】
19. case harrier:20. ( harrier )。14. public static void main(String [] args) {15. Dogs myDog = 。20. case harrier:21. ( harrier )。15. switch (myDog) {16. case collie:17. ( collie )。F. if( () () ) {}Answer: BFQuestion 39Given:11. public class Test {12. public enum Dogs {collie, harrier, shepherd}。C. Color purple = new Color( 0xff00ff)。17. public static void main( String[] argv) {18. // insert code here19. }20. }Which two code fragments, inserted independently at line 18, allow theFabric class to pile? (Choose two.)A. Color skyColor = BLUE。 }15. public int getRGB() { return rgb。13. private final int rgb。17. }18. }19. public static void main(String[] args) {20. (( Doe , John ))。14. private Title(String t) { title = t。 c++)Answer: AQuestion 37Given:11. public enum Title {12. MR( Mr. ), MRS( Mrs. ), MS( Ms. )。 c++)E. for( Color c = 。 ())Copyright Tarena Corporation, rights reservedD. for( Color c = Color[0]。 c++)C. for( Color c。 }16. }17. }Which code inserted at line 14 causes the foo method to print RED,GREEN, and BLUE?A. for( Color c : ())B. for( Color c = RED。Answer: CEQuestion 36Given:11. public class Ball {12. public enum Color { RED, GREEN, BLUE }。E. import 。D. import .*。C. import 。 }7. }The class Beta and the enum Color are in different packages.Which two code fragments, inserted individually at line 2 of the Betadeclaration, will allow this code to pile? (Choose two.)A. import .*。2. // insert code here3. public class Beta {4. Color g = GREEN。Answer: DQuestion 35Given:1. package 。C. Direction d = 。Which method signature follows the JavaBeans naming standards formodifying the itemld instance variable?A. itemID(int itemId)B. update(int itemId)C. setItemId(int itemId)D. mutateItemId(int itemId)E. updateItemID(int itemId)Answer: CQuestion 34Given:10. class Nav{11. public enum Direction { NORTH, SOUTH, EAST, WEST }12. }13. public class Sprite{14. // insert code hereCopyright Tarena Corporation, rights reserved15. }Which code, inserted at line 14, allows the Sprite class to pile?A. Direction d = NORTH。11. private String name。Answer: DQuestion 32Copyright Tarena Corporation, rights reservedA JavaBeans ponent has the following field:11. private boolean enabled。C. Point p = (new Line()).getPoint()。 }13. }14. class Triangle {15. public Triangle() {16. // insert code here17. }18. }Which code, inserted at line 16, correctly retrieves a local instance of aPoint object?A. Point p = ()。 } }Answer: CQuestion 31Given:10. class Line {11. public class Point { public int x,y。 } }C. new Foo() { public int bar(){return 1。17. }18. }Which code, inserted at line 15, allows the class Sprite to pile?A. Foo { public int bar() { return 1。 }11. public class Sprite {12. public int fubar( Foo foo) { return ()。 }6. })。34. }35. }What is the result?A. snootchy 420 third second firstB. snootchy 420 first second thirdC. first second third snootchy 420D. third second first siiootchy 420E. third first second snootchy 420F. first second first third snootchy 420Answer: DQuestion 29Given:1. interface TestA { String toString()。29. }30.31. public static void main(String[] args) {32. Bootchy b = new Bootchy()。27. = snootch。22. ( second )。17. ( ” first “ )。13. String snootch。 } is added tothe Plant class.E. The code will pile if public Plant() { Plant( ” fern ” )。 } is added to theTree class.C. The code will pile if public Plant() { Tree()。 }4. public String getName() { return name。25. }26. }What is the result?A. 4321B. 0000C. An exception is thrown at runtime.D. Compilation fails because of an error in line 18.Answer: DQuestion 27Given:1. public class Plant {2. private String name。 }19. }20.21. public class EmployeeTest {22. public static void main(String[] args) {23. Employee e = new Employee( ” 4321 ” )。 }14. }15.16. class Employee extends Person {17. String empID = “ 0000 ” 。3. }1. public class AImpl implements A {2. public void doSomething(String msg) { }3. }1. public class B {2. public A doit() {3. // more code here4. }5.6. public String execute() {7. // more code here8. }9. }1. public class C extends B {2. public AImpl doit() {3. // more code here4. }5.6. public Object execute() {7. // more code here8. }9. }Which statement is true about the classes and interfaces in theexhibit?A. Compilation will succeed for all classes and interfaces.B. Compilation of class C will fail because of an error in line 2.C. Compilation of class C will fail because of an error in line 6.D. Compilation of class AImpl w