Notes
Types of Errors
Content of the notes (3)
Page 1
Types of Errors
Errors may be broadly classified into two:
Compile time errors
Run time errors
Page 2
Compile Time Errors
All Syntax errors are detected and displayed by Java Compiler and therefore these errors are known as Compile time errors.
Java will not create .class file until the program compiled successfully.
Therefore it is necessary to fix all the errors before we compile and run the java program.
Sometimes,a single error may be the source of multiple errors,later in the compilation.
Most of the compile time errors are due to typing mistakes.The most common problems are:
Missing semicolon
Missing or mismatch of brackets
Misspelling of identifiers and keywords
Missing double quotes
Use of undeclared variables
Bad reference to objects
Use of = in place of == and so on.
Page 3
Run Time Errors
Sometimes a program may be compiled successfully and the .class file will be created but may not run properly.
Such programs may produce wrong output due to logical error or may terminate due to errors such as Overflow.
Most common Run Time errors are;
Dividing an integer by zero
Accessing the element out of the bounds of an Array
trying to store a value into an array of an incompatible class or type.
Trying to illegally change the state of a thread and many more.
Information
- Description
- JAVA Note on Types of Errors, created by shanid m on 11/10/2016.
- Created by
- shanid m
- Views
- 0
- Rating