Keywords are the pre-defined words which convey special meaning to the compiler. These words have predefined meaning.
Example- 'class' keyword is used for creating class
There are 50 keywords in java.

  • Example of using java keywords -

     //program for addition of two number
    // 'class ' is keyword used for creatig the class
    class Add
    	public static void main(String[] args) {
    		//'public,static,void 'also a keyword which convey specific meaning
    		int a=5;
    		int b=4;
    		int c=a+b;
    		System.out.println("Addition ="+c);
  • Java 9 has some new module-related keywords.

    These keywords are as follows

    Java 9 has some new module-related keywords.
    • It is important to understand that these keywords are recognized as keywords only in the context of a module declaration. Otherwise, they are interpreted as identifiers in other situations.

    • Because they are context-sensitive, the module-related keywords are formally called Restricted keywords .

See Full List of keywords

List of all keywords and their use

What next?

The next topic is Identifiers in java

Share this page