I was reading about Run-time error and compilation error from
Runtime vs Compile time and How exactly does java compilation take place?
and what I could infer is, during compilation the compiler does not check for the logic but only the syntax and typo errors and where at run-time the logic is checked and how these are implemented etc.. like division by zero, memory not sufficient.
So if my understanding is right then one get compilation error only during compilation stage and run-time error only while executing the program..
For example let me consider a simple program
public class Try {
public static void main(String[] args) {
System.out.println("My first program");
}
}
Now when i compile (i.e javac ) at this stage if any errors are produced then those errors are called compilation errors during which syntax and typo errors are checked.
and the errors produced during the process of converting the byte code to native/machine code (e.e java ) is called run-time error during which program logic is checked.
So one can get compilation error only at the beginning of execution and run-time error only at the second stage(i.e converting byte code to machine code).
Please correct me if my understanding is wrong...