HI All,
I am preparing for the
SCJP 6 and my question is in the below example:
This is from the K&B book, chapter 8, Pg 666, Question 4.
Options are
A. Boo f = new Bar (24) { };
B. Boo f = new Bar() {};
C. Boo f = new Bar() {String s; };
D. Bar f = new Boo(
String s) {};
E. Boo f = new Boo.Bar(String s) {};
The correct options are B and C, and until now it all makes good sense to me. But I coded this in eclipse and here is what I tried:
So I am creating a new anonymous inner class and providing a constructor inside it which will accept an integer.
This gives me compiler error. I am wondering why it is possible to only Override the super constructors
and NOT overload them like I am trying.
Any help will be much appreciated. Thanks.