Glen Iris wrote: 1 - I cannot understand why Car.this.drive(); needs to be wrapped in chain brackets
That is because, method invocation is not allowed inside a class and outside any method and any initializing block.
When we say then we put method call to drive inside initialization block, hence it works.
Glen Iris wrote: 2 - Placing the code
will produce the same output (hi). How is this so?
Well, that is because, the call to drive method was simply removed from initializer block and added to default constructor of Engine. When go method creates a new object of Engine, drive method is invoked.
public static void main(String  args)
A a=new A();
You will get an error.......
But if you put System.out.println("hello"); inside parenthesis you wont get any error......
cause when you put that statement inside parenthesis then it become an init block...which get loaded in stack
when we instantiate A.
so Parenthesis are required..........
OCJP 1.6 Certified
subject: Inner Classes and the word 'this'- Chapter 8 Question 9 page 697