Add to Google Reader or Homepage


In any programming language,code would not be perfect at the very first attempt.There may be lot of errors associated with the code.Those errors can be classified into two types. 

They are:
1.Compile-Time Errors
2.Run-Time Errors

Compile-Time Errors:

The Compile time error occurs only when particular syntax or semantics of the programming language is not met. In order to get the desired output, these compilation errors must be resolved.There are a lot of compilation errors each corresponds to a specific syntax or semantic aberration.

These Compile-Time errors are in turn be classified as

  • Lexical Errors- Occurs when the keywords are misspelled or when a disallowed character is used in the code
  • Syntax Errors- Occurs when the statement in the code does not corresponds to the syntax
  • Semantic Errors-Occurs when there is a conflict in the code.

 Some of the most common compile time errors that could be expected during compilation of the programs are listed below.

Misuse of keywords:

The keywords are reserved words in a programming language.When these keywords are misused in a statement in the program then errors will occur.


void main()
int for=0;

In the above code "for" is the reserved keyword which is used in "for loop".So this will cause an error.Similar keywords are switch,case,int for,while,do,if,else,const,static,etc..

Missing Semicolon:

At the end of each statement in the code Semicolon(;) should be used to indicate the end of the statement.If it is not used then the compiler will have no idea about where the statement terminates.


void main()
int a=0

In the above code there is no semicolon which results in a error.


Post a Comment

java errors and exceptions © 2010 | Designed by Chica Blogger | Back to top