QUESTION 25 Given: 35. String #name = "Jane Doe"; 36. int $age = 24; 37. Double _height = 123.5; 38. double ~temp = 37.5; Which two statements are true? (Choose two.) A. Line 35 will not compile. B. Line 36 will not compile. C. Line 37 will not compile. D. Line 38 will not compile. Solution : AD plus imformation A variable's name can be any legal identifier — an unlimited-length sequence of Unic..
QUESTION 24 Given: 1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return "a"; 6. } 7. public double doit(int x) { 8. return 1.0; 9. } 10. } What is the result? A. An exception is thrown at runtime. B. Compilation fails because of an error in line 7. C. Compilation fails because of an error in line 4. D. Compilation succeeds and no runtime errors with class A occur...
QUESTION 23 Given: package com.sun.scjp;public class Geodetics { public static final double DIAMETER = 12756.32; // kilometers } Which two correctly access the DIAMETER member of the Geodetics class? (Choose two.) A. import com.sun.scjp.Geodetics; public class TerraCarta { public double halfway() { return Geodetics.DIAMETER/2.0; } B. import static com.sun.scjp.Geodetics; public class TerraCarta{..
QUESTION 22 Given: 1. class X { 2. X() { System.out.print(1); } 3. X(int x) { 4. this(); System.out.print(2); 5. } 6. } 7. public class Y extends X { 8. Y() { super(6);System.out.print(3); } 9. Y(int y) { 10. this(); System.out.println(4); 11. } 12. public static void main(String[] a) { new Y(5); } 13. } What is the result? A. 13 B. 134 C. 1234 D. 2134 E. 2143 F. 4321 Solution : C
QUESTION 21 Given: abstract public class Employee{ protected abstract double getSalesAmount(); public double getCommision() { return getSalesAmount() * 0.15; } } class Sales extends Employee {17. // insert method here } Which two methods, inserted independently at line 17, correctly complete the Sales class? (Choose two.) A. double getSalesAmount() { return 1230.45; } B. public double getSalesAm..
QUESTION 20 Given:class One { void foo() { } }class Two extends One{ 14. // insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.) A. int foo() { /* more code here */ } B. void foo() { /* more code here */ } C. public void foo() { /* more code here */ } D. private void foo() { /* more code here */ } E. protected void foo() {..