• 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
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Compilation Error and Run time exception

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having hard time to identify whether a query is a compilaiton error or run time exception. Is there any key points that I need to look for when identifying both
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "query"? Can you post some code? The differences between compile time and run time exceptions are relatively easy to explain but I don't want to do that if you're confused only about a small piece of code...
 
Bhasker Komandur
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I meant in general. I am from DB2 background and my hand typed query.
 
Ranch Hand
Posts: 814
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First give the code then we try to solve it
Ok

Regards
Ninad
 
Noam Wolf
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well in (very) general:

Compile time error - is an error that your compiler will catch, or one that your compiler "knows" is incorrect. For example if you try to assign an incorrect type:

Integer myInteger = new ArrayList();

Your compiler complain that there is a type mismatch... so it's "saving you from yourself" or in other words pointing out any syntactic error that can be picked up from Java's grammar.

Runtime errors - these are errors that could not have been for foreseen before the application actually *ran* and therefore the error will be thrown at runtime, or when the application is executing. So a good example is if you have a method that does simple division and accepts two integers, it's quite possible that one of the integers passed will be 0 and if you try to divide by zero you'll get a runtime error. There was no way for Java to foresee that you will pass that value. (this is a dumb example but illustrates the point)

After you get past this I suggest you read more into the differences between checked and unchecked errors in java...
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compiler errors can be defined as the errors arising in your code due to some incorrect syntax (encountered while parsing) OR something whose meaning/semantics is wrong and can be found out just by looking at the syntax ....whereas the problem in logic OR something which produces undesired/incorrect results while execution comes as Run time error


I hope that helps a bit!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic