| Author |
K & B 1.5 Chapter 8 self Test Q.12
|
Andrew Danieli
Greenhorn
Joined: Nov 26, 2008
Posts: 5
|
|
Hi All, I've been lurking for a while, but thought I'd get some help with a question where the code doesn't seem to match the answer? My first look at C8.Q12 was to choose answer A, which is what the book said was correct, however when I typed the code in (and alternately cut-n-pasted from the pdf), I get a compilation error on "AbstractTest.Bar f = t.new Bar () {..." Error(46,36): class AbstractTest.Bar is abstract; cannot be instantiated I couldn't see anything in the Errata so I thought I'd check with the authors. I'm starting to panic a bit as my exam is on Friday, and I'm worried that I haven't prepared enough (read the book a several times, done all the Sun mock exams twice + the K & B self tests & the examulator freebie exam). Thanks Andrew
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
Hi Andrew! Welcome to javaranch. Well the question is question no. 6 in my SCJP 6 book. The pdf doesn't let me to copy paste the code (I don't how it let you CUT paste the code ). Other than that I think the code must run fine. Just post the complete code here.
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Andrew Danieli
Greenhorn
Joined: Nov 26, 2008
Posts: 5
|
|
Thanks for the welcome. Here's the code from my source file. I'm using JDeveloper 10.1.3.3 and the error I get as mentioned above is:- Error(46,36): class AbstractTest.Bar is abstract; cannot be instantiated
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
Andrew the code runs fine on my jdk 1.6...
|
 |
Andrew Danieli
Greenhorn
Joined: Nov 26, 2008
Posts: 5
|
|
Same here. I've got the Sun JDK 1.6 on my PC as well as the Oracle 1.5 JDK inside JDeveloper. Just tried and it compiled quite happily in 1.6. Something odd with Oracle. As I can't compile the code in the real exam, I'll have to go with my gut instinct, for some of the answers. Thanks for your help. Andrew
|
 |
Vikas Govindswamy
Greenhorn
Joined: Aug 27, 2008
Posts: 18
|
|
Hi Andrew, Even i am also preparing for SCJP1.5 I ran the same code (in Eclipse3.4 with Java1.5 installed) that you pasted above, and it is running fine and giving the output 57 22. -Vikas
|
 |
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
|
|
FWIW - When Sun created the real exam, all of the questions were compiled and tested from the command line, and when we wrote the book we also used the command line exclusively. Bottom line - we STRONGLY recommend NOT using IDEs to study for the exam. Bert
|
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
|
 |
Andrew Danieli
Greenhorn
Joined: Nov 26, 2008
Posts: 5
|
|
Hi Bert, Thanks for the advice. This is the only problem I've had so far. Given I've only got a day left before the exam, its a little late to change tack. I'll let everyone know how I get on. Regards Andrew
|
 |
Andrew Danieli
Greenhorn
Joined: Nov 26, 2008
Posts: 5
|
|
Hi All, I thought I should let you know that I passed. Thanks go to Kathy and Bert for a 1st class book, especially the bit about exam techniques. Its going to be my new java reference bible. Regards Andrew
|
 |
 |
|
|
subject: K & B 1.5 Chapter 8 self Test Q.12
|
|
|