Sun Certified Java Developer Interview Questions & Answers
Below we have listed all the Sun Certified Java Developer Interview Questions and answers. Feel free to comment on any Sun Certified Java Developer Interview Questions or answer by the comment feature available on the page.
To buy an eBook containing 30,000 Interview Questions, with Answers, Click Here.
View All Sun Certified Java Developer Interview Questions & Answers - Exam Mode /
Learning Mode
Getting certified by Sun Microsystems, Inc., is a great way to invest in your professional development and to help boost your career potential. IT managers know that the skills verified during the certification process are the same skills that can lead to increased productivity and enhanced staff credibility. In addition, you can tap into new and larger markets with Sun certifications.
Sun's philosophy is that certification is central to the learning process because it provides validation of skill sets for specific job roles. Sun certification also offers a natural progression to support your career goals.
Given: 1. public class Threads2 implements Runnable { 2. 3. public void run() { 4. System.out.println("run."); 5. throw new RuntimeException("Problem"); 6. } 7. public static void main(String[] args) { 8. Thread t = new Thread(new Threads2()); 9. t.start(); 10. System.out.println("End of method."); 11. } 12. } Which two can be results? (Choose two.) A. java.lang.RuntimeException: Problem B. run. java.lang.RuntimeException: Problem C. End of method. java.lang.RuntimeException: Problem D. End of method. run. java.lang.RuntimeException: Problem E. run. java.lang.RuntimeException: Problem End of method.
Given: 11. class Mud { 12. // insert code here 13. System.out.println("hi"); 14. } 15. } And the following five fragments: public static void main(String...a) { public static void main(String.* a) { public static void main(String... a) { public static void main(String[]... a) { public static void main(String...[] a) { How many of the code fragments, inserted independently at line 12, compile? A. 0 B. 1 C. 2 D. 3 E. 4 F. 5
Given: 21. class Money { 22. private String country = "Canada"; 23. public String getC() { return country; } 24. } 25. class Yen extends Money { 26. public String getC() { return super.country; } 27. } 28. public class Euro extends Money { 29. public String getC(int x) { return super.getC(); } 30. public static void main(String[] args) { 31. System.out.print(new Yen().getC() + " " + new Euro().getC()); 32. } 33. } What is the result? A. Canada B. null Canada C. Canada null D. Canada Canada E. Compilation fails due to an error on line 26. F. Compilation fails due to an error on line 29.
Given: 11. class PingPong2 { 12. synchronized void hit(long n) { 13. for(int i = 1; i < 3; i++) 14. System.out.print(n + "-" + i + " "); 15. } 16. } 17. public class Tester implements Runnable { 18. static PingPong2 pp2 = new PingPong2(); 19. public static void main(String[] args) { 20. new Thread(new Tester()).start(); 21. new Thread(new Tester()).start(); 22. } 23. public void run() { pp2.hit(Thread.currentThread().getId()); } 24. } Which statement is true? A. The output could be 5-1 6-1 6-2 5-2 B. The output could be 6-1 6-2 5-1 5-2 C. The output could be 6-1 5-2 6-2 5-1 D. The output could be 6-1 6-2 5-1 7-1
Given: 1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return "test"; } 6. }); 7. } 8. } What is the result? A. test B. null C. An exception is thrown at runtime. D. Compilation fails because of an error in line 1. E. Compilation fails because of an error in line 4. F. Compilation fails because of an error in line 5.