Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compilation and runtime.....

 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In some of the questions of the mock exams, i came across options where they ask if its a compilation error or runtime one.My doubt was that, is there a proper way through which we can find out the difference between compile and runtime errors?

Let me re-phrase the question , What all things happen during the compile time and the runtime?

Thnks,
Piyu
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
piya rai wrote:

In some of the questions of the mock exams, i came across options where they ask if its a compilation error or runtime one.My doubt was that, is there a proper way through which we can find out the difference between compile and runtime errors?



Compilation errors are mainly due to syntax errors made by the programmer (Compiler make sure the program is syntactically correct to be run by the JVM). But the runtime errors are due to actual runtime information (actual type of an object, the data passed to methods are incompatible etc...) which are unable to determine at the compile time.
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those causes of runtime errors are rare. Runtime errors are usually expressed by Exceptions. Go and find the Exception class and its subclasses; each subclass represents a type of runtime error which Java knows about already.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic