• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compiles with warning?

 
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Whats the diffrence between
[1] compiles with warning
[2] compiler error?
Thanks.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy Cathy (nice name, by the way , although you do spell it strangely)
A compiler error means it won't compile until you fix it, as you know.
A compiler *warning* is almost always because you're using something deprecated. So a warning is like the compiler saying, "Well... I will let you do this, but you really shouldn't, and I hope that you know what you're doing, and we REALLY don't do it this way anymore, and you should check it out, but if you INSIST, I'll go ahead and let it compile and you can use it."
So, if you get a warning, you can still run, and probably work just fine in any environment, since deprecated methods still *work* even if they are no longer recommended.
If you DO get a deprecation warning, you can compile using the -deprecation flag and often get more information about the deprecated method, including what you should replace it with.
cheers,
Kathy
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compiles with warning -- means the program compiled successfully, but there was some non-fatal issue with the code that the compiler wanted you to know about. Maybe some of the code was deprecated:

if you compile this with the normal "javac Warning.java" you get:

whereas if you code it with a flag to hide all warnings "javac Warning.java -nowarn" you get:

and as Kathy (with a K) mentioned, you can also show the details of the deprecation using the snazzy -deprecation flag:

compiler Error is just what you expect -- some error (a missing semi-colon or whatever) that has prevented the code from being compiled successfully into a class.
[ November 19, 2003: Message edited by: Jessica Sant ]
 
Cathy Song
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jess and Kathy,
Please tell me these will *not* be the kind of choices that I will have to make in the real exam... :roll:
Thanks.
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cathy Song:
Jess and Kathy,
Please tell me these will *not* be the kind of choices that I will have to make in the real exam... :roll:
Thanks.


these will *not* be the kind of choices that you will have to make in the real exam.
 
Cathy Song
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks you all. I am taking the exam on Nov 25th..
And I am getting very nervous as the days go by.
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the best Cathy ! So next Tuesday, you'll be an SCJP huh?
Cheers
Harwinder
reply
    Bookmark Topic Watch Topic
  • New Topic