Page 131 - CA_Blue( J )_Class9
P. 131
33 System.out.println(sum +"\t"+ avg);
34 System.out.println("-----------------------------------");
35 }
}
36
You will get the following output:
6.7 ERRORS IN JAVA
In Java, we may encounter situations or code that result in illegal operations, causing the execution to stop or
produce an incorrect output. These issues are known as errors. Some errors lead to exceptions, which disrupt the
normal flow of the program. These exceptions should be identified and resolved during debugging and testing.
There are three types of Errors:
ERRORS IN JAVA
Syntax Error Logical Error Runtime Error
Definition
When executing code, certain situations or operations may result in illegal actions, causing
the execution to stop or produce incorrect output. These are known as errors in Java.
6.7.1 Syntax Error
When writing code, we may make mistakes like missing a semicolon (;) at the end of a statement or misspelling
keywords. These errors are called syntax errors, as they violate the grammatical rules of the programming language.
Input in Java 129

