other basic stuff


Java is a free-form language. This means that you do not need to follow any special indentation rules. For instance, the Example program could have been written all on one line or in any other strange way you felt like typing it, as long as there was at least one whitespace character between each token that was not already delineated by an operator or separator. In Java, whitespace is a space, tab, or newline.


Identifiers are used for class names, method names, and variable names. An identifier may be any descriptive sequence of uppercase and lowercase letters, numbers, or the underscore and dollar-sign characters. They must not begin with a number, lest they be confused with a numeric literal. Again, Java is case-sensitive, so VALUE is a different identifier than Value.

int temperature = 35; // temperature is an identifier


A constant value in Java is created by using a literal representation of it.

int temperature = 35; // 35 is a literal


Single Line Comments

int temperature = 35; // this is single line comment

Multiple Line Comments

int temperature = 35; /* this is
a multiline
int humidity = 80;

Java Keywords

Java Keywords are the reserved words that you cannot use as Identifiers in your program. every program uses some of these keywords so that compiler understand what is declared and defined in program. The keywords are as follows :-

 abstract  continue  for  new  switch
 assert  default  goto  package  synchronized
 boolean  do  if  private  this
 break  double  implements  protected  throw
 byte  else  import  public  throws
 case  enum  instanceof  return  transient
 catch  extends  int  short  try
 char  final  interface  static  void
 class  finally  long  strictfp  volatile
 const  float  native  super  while