What are the differences between Syntax errors and Runtime errors (java)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What are the differences between Syntax errors and Runtime errors (java)?

At least 2 valid, distinct differences ...

29th Jul 2017, 10:21 AM
Danish Javed
Danish Javed - avatar
4 Answers
+ 8
• A program with a syntax error cannot be executed. A program with a runtime error can be executed but crashes due to certain conditions. • Syntax errors are static errors that can be detected by the compiler. Runtime errors are dynamic errors that cannot be detected by the compiler.
29th Jul 2017, 10:36 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
Syntax error is an error that is caused by misspelled command, you get this error under two conditions, when you're typing in the editor (with syntax highlighting support) or during compilation process. Syntax error is non fatal because you still have a chance to fix it. Runtime error is a hard error that mostly be caused by logic error, your compiler may have compiled your code successfully, and your code had been turned into an executable. Runtime error is fatal because on occurrence your running application will come to a halt, and prematurely terminate its code execution. In short, syntax error occurs during development, and runtime error occurs after development. Hth,
29th Jul 2017, 10:39 AM
Ipang
+ 4
Thanks @Hatsy Rei
29th Jul 2017, 10:43 AM
Danish Javed
Danish Javed - avatar
+ 3
Thanks @Ipang
29th Jul 2017, 10:43 AM
Danish Javed
Danish Javed - avatar