Java – lexical issues

1,614 views

Published on

Java – lexical issues

Published in: Technology, News & Politics
  • Be the first to comment

Java – lexical issues

  1. 1. Java – Lexical ElementsT S Pradeepkumar
  2. 2. Overview• White space• Identifiers• Literals• Comments• Separators• Keywords
  3. 3. White spaceWhitespace is java may be• A space• A new line• A tab
  4. 4. Identifiers• Used for naming variable names, method names and class names• Should not start with a number (as it confuse with a number) orthere should not be any hyphen – in any identifiers.• Can start witho _ (underscore)o $ (dollar symbol)o Uppercase or lowercase alphabetsExamplesAudi count a7 $good this_is_ok
  5. 5. LiteralsIt is a constant created in Java.88 is an integer76.5 is a float„A‟ is a character“I am a string” is a string88 76.5 „A‟ “I am a string”
  6. 6. Comments• Three typeso Single line comment (Similar like C++)• //o Multiline comment (similar like C++)/*------*/o Documentation comment (useful for producing HTML documents)/**----------*/
  7. 7. Separators
  8. 8. Keywords (totally there are 50)

×