Professional Documents
Culture Documents
Part 2
1. Syntax Error – This type of error occurs due to incorrect use of the syntax
or format of the programming language and is identified during the
compilation of the code.
Eg:
system.out.Println(JAVA”)
a. “ s ” is in lower case
b. “ P ” is in upper case
c. Opening double quotes is missing
d. Semicolon is missing
2. Logical Error – This type of error occurs due wrong logic of the code which
results in incorrect or unexpected output is not identified either during
compilation nor during execution of the code.
Eg:
int avg = a + b + c / 3 ;
The above line will not generate any error but gives us an unexpected
output. In this case instead of average we get the addition of a, b and c/3.
int avg = (a + b + c) / 3 ;
3. Runtime Error – This type of error occurs and is identified during the
execution of a program.
Eg:
The Java comments are the statements that are not executed by the compiler and
interpreter. The comments can be used to provide information or explanation about
the variable, method, class or any statement. It can also be used to hide program
code.