import java.io.*; public class Bing{ Bing(String s){} Bing(){ } } import java.io.*; public class Bang extends Bing{ Bang(){ } Bang(String bangS){super(bangS);} //Insert code here } what code if inserted at the comment would not result in any errors Answers given are 1) Bing b = new Bang(){}; 2) Bing b = new Bing(){"Foo";}
But if (2) is placed at the comment, the code does not compile. How is (2) correct??
Dan Chisholm
Ranch Hand
Joined: Jul 02, 2002
Posts: 1865
posted
0
Saith, It appears that you are correct. I'm sure that Bert will be here soon to offer a response.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
I agree that it wouldn't compile. But when taking this question I selected that as one of the correct options. Because we need to select two. I found that there is wrong answer for one of the bitwise operation questions in Master exam 1 and in Master exam 2 there are at least two questions that have wrong anser. I will post these questions in the coming days on this forum. [ March 11, 2003: Message edited by: Sarma Lolla ]
Param Yanamandra
Ranch Hand
Joined: Jun 06, 2002
Posts: 33
posted
0
Hi, Is there any location online where I can find all the erratta of this book. Thanks in advance, Param
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
posted
0
Sarma and Param, We want to thank all the JavaRanchers for using our book! We try to answer as many posts as we can, but we are not always able to answer them all! For instance, we will be gone for the next several days. We have two requests in general: 1) Please check the errata page at wickedlysmart.com 2) If you find an error, please send us an email at wickedlysmart.com (either bert.bates or kathy.sierra). This way we will be sure not to miss any of the errors that you find! Back soon! -Bert p.s. - Valentin is correct, the question listed at the beginnning of this thread does have a typo [ March 11, 2003: Message edited by: Bert Bates ]
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
Param Yanamandra
Ranch Hand
Joined: Jun 06, 2002
Posts: 33
posted
0
Thanks Bert for putting them online. It will be lot easier.
Param
Marlene Miller
Ranch Hand
Joined: Mar 05, 2003
Posts: 1391
posted
0
2) Bing b = new Bing(){"Foo";} Do you suppose what they meant to say is Bing b = new Bing("Foo"){};