Practice Exam
Question 1 |
Given the following definition of the Demo class and the DerivedDemo class:
1. public class Demo extends Object { 2. String Title ; 3. public Demo( String t ){ 4. Title = t ; 5. } 6. public void showTitle() { 7. System.out.println("Title is " + Title) ; 8. } 9. } 10. class DerivedDemo extends Demo { 11. public void setTitle( String tt ) { Title = tt ; } 12. } What happens if you try to compile this code, create a DerivedDemo object, and immediately call the showTitle method of that object?
|
Question 2 | Which of the following class declarations are not correct ... |
Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.