permaculture playing cards*
The moose likes Beginning Java and the fly likes Compilation and runtime..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compilation and runtime....." Watch "Compilation and runtime....." New topic
Author

Compilation and runtime.....

mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72
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

Joined: Mar 24, 2008
Posts: 3816

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.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
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.
 
 
subject: Compilation and runtime.....
 
Similar Threads
What is diamond Problem Faced in Multiple inheritence in java ?
tag files validation
[Maven] Accessing classpath information from JUnit tests executed by Surefire
using javac.Main
how many String objects created??