i came across this question and was not satisfied with the explanation (informit)
========================================================================
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 we try to compile this code, create a DerivedDemo object, and immediately call the showTitle method of that object?
A) The message "Title is null" is written to standard output.
B) The compiler complains about the DerivedDemo class.
C) A NullPointerException is thrown in line 7.
========================================================================
my initial answer is "A" but according to the result the answer should have been "B"...
honestly, i dont get it...
please forgive my overly pathetic question... i am a newbie and wanted to take the
scjp in a few month... so please help me...
thanks..
ali