Javatpoint Logo
Javatpoint Logo

Lexical Error

During the lexical analysis phase this type of error can be detected.

Lexical error is a sequence of characters that does not match the pattern of any token. Lexical phase error is found during the execution of the program.

Lexical phase error can be:

  • Spelling error.
  • Exceeding length of identifier or numeric constants.
  • Appearance of illegal characters.
  • To remove the character that should be present.
  • To replace a character with an incorrect character.
  • Transposition of two characters.


In this code, 1xab is neither a number nor an identifier. So this code will show the lexical error.

Next TopicSyntax Error

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA