• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Slightly different compile error msgs using 1.4.1

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, and what's more, the error messages are compiler vendor dependent.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Linda Pan
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An interesting finding. Thank you for responding and confirming my question.
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic