Friday, April 2, 2010

Syntax and Grammar of Java

  1. Identifiers are names of variables, functions, classes etc.
  2. A keyword or reserved word 
  3. Java technology supports three type of comments
  4. Read about full lexical structure of java
  5. Integer literals can also be specified as octal (base 8), or hexadecimal (base 16). Octal and hexadecimal have 0 and 0x prefix respectively. So 03 and 0x3 are representation of integer three in octal and hexa-decimal respectively.
  6. Java technology supports the primitive types - boolean (for representing true or false), a character type called char, four integer types (byte, short, int and long) and two floating point types (float and double). Click here for more.
  7. Corresponding to all the primitive type there is a wrapper class defined. These classes provide useful methods for manipulating primitive data values and objects. See here. 
  8. Limits of these datatypes
  9. Default values of primary datatypes 
  10. Variables 
  11. A Java source file format
  12. The Java interpreter executes a method called main, defined in the class specified in command line arguments. The main method is the entry point for execution of a class. In Java technology the main method must have the following signature -
    public static void main(String args[])
    The java interpreter is invoked with the name of the class as an argument. The class name is followed by possible set of arguments for the main function of the class. When a Java program is invoked then the Java interpreter name "java" and the class name are not passed to the main() method of the class. The rest of the command line arguments are passed as an array of String. For example invoking java Sky blue gray
    would invoke main method of Sky class with an array of two elements - blue and gray. 
    args[0]=blue , args[1] = gray

No comments:

Post a Comment