Keywords are reserved words that are predefined in the language; see the table below (Taken from Sun Java Site). All the keywords are in lowercase.
abstract default if private this
boolean do implements protected throw
break double import public throws
byte else instanceof return transient
case extends int short try
catch final interface static void
char finally long strictfp volatile
class float native super while
const for new switch
continue goto package synchronized
Keywords are marked in yellow as shown in the sample code below /** This class is a Hello World Program used to introduce
the Java Language*/
public class HelloWorld {
public static void main(String[] args) {
System.out.println(”Hello World”); //Prints output to console
}
}
Some Tricky Observations: The words virtual, ifdef, typedef, friend, struct and union are all words related to
the C programming language. const and goto are Java keywords. The word finalize is the name of a method
of the Object class and hence not a keyword. enum and label are not keywords.
No comments:
Post a Comment