Friday 30 October 2015

Java Programming Errors and Debugging


There is nobody on earth who has not made a mistake one way or the other.
In this same vein, there is no one who began programming from the bottom to the top without making errors here and there.

In Java programming there are three types of errors which are:

1.   Syntax Error
2.   Runtime Error
3.   Logical Error


Syntax Error is a type of error made by a programmer while writing the program. This error can be easily detected by the computer.



One can make a syntax error by not declaring a variable, not using the right punctuation, wrong spelling of keywords, etc.
Correction of syntax error is as easy as possible because the computer shows you the line with the problem and sometimes tells you what to do to get it right.


Runtime Error is a type of error that terminates the program in an abnormal way. This error occurs major as a result of inappropriate mathematical computations. This kind of error can come to your screen when you try to do computations such as 1/0.


Logical Error is a type of error that occurs when two values, datatypes, objects, classes, methods etc do not come to terms. For example:
When you as the programmer writes a program for the user to enter his or her age and the user enter his or her name. You see that age has to do with the integer datatype while name goes to the String datatype. Therefore, the two do not come to terms and as a result of this a logical error comes to the screen at once.


Debugging is the process of correcting errors and bugs in a program.

No comments:

Post a Comment