-2

Can somebody explain me this basic concept. What is the difference between run time error and compilation error?

  • 6
    http://stackoverflow.com/questions/9471837/what-is-the-difference-between-run-time-error-and-compiler-error – OPK Jan 26 '16 at 17:47

1 Answers1

0
  1. Compile time error : You get this error when you compile the program. With compilation error you will not be able to run or execute the program.
  2. Run time error: You can compile the program successfully. When you run the program, you will get error or exception
  3. You get compile time error then it is due to some coding mistake by developer that compiler can understand.

For example, lets say you create a variable of type integer but by mistake you try to store a string value into it.
int number = "hello";
When you try to compile the program, compiler finds out the data type mismatch and gives a compilation error. Can not convert from string to integer.
You can not run program until you fix this either by changing the data type or by changing the value you are assigning.

sujeet14108
  • 568
  • 5
  • 19