JAVATM- The Beginnings

Variables

 

Section 1 - Keywords

 

keyword is one of the words used to define the syntax of the Java programming language. The following are a few examples of Java keywords:

 

class public static void

 

Section 2 - Identifiers

 

An identifier is a valid name. Java defines the following rules for identifiers:

 

  • The first character must be an uppercase or lowercase letter, $, or _
  • Subsequent characters must be an uppercase or lowercase letter, $, _, or a digit
  • Identifiers may not contain punctuation or whitespace
  • Identifiers may not be the same as a keyword
  • There is no limit to the length of a Java identifier

 

The following are examples of valid Java identifiers:

 

        hello1                

        $mother        

        _father                

        BaBy                

        hello_world        

 

The following are examples of invalid Java identifiers:

 

        1hello                (identifier may not begin with a digit)

        hello world        (identifier may not contain whitespace)

        hello;world        (identifier may not contain punctuation)

 

Java is a case sensitive language: baby, BABY, and BaBy are three different identifiers.

 

 

 

Copyright ©2017 by Ralph Lecessi Incorporated. All rights reserved.



Back to ralphlecessi.com