This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

plz help about complie time and runtime errors

 
anurag priya
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear all ! plz someone tell me the different conditions under which a compiletime and runtime error may occur ! plz send it in simplied form!
regards.
anurag.
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a lot of differences, but something you can kind of rely on, is if the compiler can see the error without processing any code, like doing arithmetic, method calls, etc..., then it will be a compiler error. Example you try to use a local varible before you initialize it, you try to convert an int to a byte without a cast.
If the compiler can't tell, but there is something that happens in your code that can cause an error, then it is a runtime error. For example, a file doesn't exist, or you try to divide an int by zero, or you perform a cast which turns out to be illegal.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic