aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Slightly different compile error msgs using 1.4.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Slightly different compile error msgs using 1.4.1" Watch "Slightly different compile error msgs using 1.4.1" New topic
Author

Slightly different compile error msgs using 1.4.1

Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
I am currently using Sun's J2SDK 1.4.1 to compile any code in the books I'm using for certification ie. Mughal's and Kathy & Bert's latest book. As I was compiling classes from different packages in Kathy & Bert's book, I'm finding that my compile errors aren't exactly the same as the book. For example:

I compiled Beverage.java and then Tea.java. The latter causes the compiler to complain: "cannot inherit from final cert.Beverage"
According to Kathy & Bert's book, (page 65 - 66): "Can't subclass final classes ... 1 error". Any reason as to why this would happen? To me, the compile errors are really saying the same thing regarding the final being used in the class. I gues it may be because I am using a slightly different version of JDK compiler?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Yes, and what's more, the error messages are compiler vendor dependent.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
The exact error wording is not specified in the JLS so compiler writers are free to make the wording how they like. The important thing is to know that it will always cause a compile error.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
An interesting finding. Thank you for responding and confirming my question.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Slightly different compile error msgs using 1.4.1