Published on Feb 22,2017
527 Views
Email Post

Errors in Java

Design Time Error– These are the errors that occur while designing the programs, for example, syntax errors.

These errors will be shown with a red mark in eclipse IDE so that one can easily find and correct them.

Let us look at an example program:

Package com.edureka.error.designerror;

Public class DesignError{

Public Static void Main (String[] args) {

System.out.printIn(“This is Design-time error”);

;

}

}

Here, in the main method, if the m in Main is capital, it will give an error and if the s of the static keyword is capital, it will do the same.

Also, a semi-colon is placed in the print statement in the end as well as below it.

Logical Errors – These are the errors done by programmers. The programs with these errors run but do not produce the desired results. A common example would be getting division of two numbers as output but expected is multiplication of numbers.

Here, if the syntax is correct, but logic is wrong, then its a logical error which will in turn give wrong results. This typically happens in complex programs where the user is unaware of the logic.

Example:

A program has instructions to print numbers 1 to 5 but prints 6.

Got a question for us? Mention them in the comments section and we will get back to you. 

Related Posts:

Hadoop & Big Data for Java Professionals

JAVA/J2EE & SOA course

About Author
edureka
Published on Feb 22,2017

Share on

Browse Categories

Comments
0 Comments