|
|

Sun 310-056: Sun Certified Programmer for J2SE 5.0 Upgrade Exam
|
#1. Given: 1. interface A { public void aMethod(); } 2. interface B { public void aMethod(); } 3. interface C extends A,B { public void aMethod(); } 4. class D implements B { 5. } 6. Class E extends D implements C { 7. public void aMethod() {} 8. public void bMethod() {} 9. public void cMethod() {} 10. }
What is the result?
|
|
#2. Given: 20. public class CreditCard { 21. 22. private Sting cardID; 25. 26. public voicd setCardInformation (String cardID, 29. this.cardID = cardID; 30. this.ownerName = ownerName; 31. this.limit = limit; 32. } 33. }
Which statement is true?
|
|
#3. Which two statements are true? (Choose two.)
|
|
#4. Given: 1. Public class Car { 2. private int wheelCount; 3. private Sting vin: 5. this.vin = vin; 6. this.wheelCount = 4; 7. } 9. return “zoom-zoom” ; 10. } 12. return “VIN: ‘ + vin + “ wheels: “ + wheelCount; 13. } 14. }
What two must the programmer do to correct the compilation errors? (Choose two.)
|
|
#5. Given: 1. class ClassA { 2. public int numberOfInstances; 3. protected ClassA(int numberOfInstances) { 4. this.numberOfInstances = number OfInstances; 5. } 6. } 7. public class ExtendedA extends ClassA { 8. private ExtendedA(int numberOfInstances) { 9. super(numberOfInstances); 10. } 11. public static void main (String[] args ) { 12. ExtendedA ext = new ExtendedA(420); 13. System. out. pint(ext. numberOfInstances); 14. } 15. }
Which statement is true?
|
|
#6. Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)
|
|
#7. Given: 10. public class starter extends thread { 11. private int x = 2; 12. public static void main (String[] args ) 13. new Starter () .makeItSo(); 14. } 15. public Starter() { 16. x = 5; 17. start(); 18. } 19. public void makeItSo() throws 20. Join(); 21. x = x -1; 23. } 24. public void run() { x *= 2; } 25. }
What is the output if the main() method is run?
|
|
#8. Given a valid DateFormat object named df, and 16. Date d = new date (0L ); 17. String ds = “December 15, 2004’ 18. //insert code here
What updates d’s values with the date represented by ds?
|
|
#9. Which three statements concerning the use of the java.io.Serializable interface are true? (Choose three.)
|
|
#10. Given : 1. public class TestString3 { 2. public static valid main (String[] args ) { 3. //insert code here 5. } 6. }
Which two code fragements, inserted independently at line3, generate the ourtput 4247?
|
|
|
|
gen. 0.297
|
Server date 22:48 10-03-2010
|
Developed by Zip © 2006
|
|
 |
|
|