codescracker


java

Java Keywords



« Previous Tutorial Next Tutorial »


Java language provides currently 50 keywords. These keywords, combined with the syntax of operation and separators, form the foundation.

Java Keyword List

Here this table lists all the 50 Java Keywords :

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 instnceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while

Java Keywords Example

Following Java program uses some keywords :

/* Java Program Example - Java Keywords
 * This program uses some keywords
 */

class JavaProgram        // class keyword here
{
    public static void main(String args[])    // public, static, and void keywords here
    {
        
        int a, b=10, c=5;       // uses int keyword here
        
        for(a=0; a<c; a++)      // uses for keyword here
        {
            System.out.println("i am " + a);
        }
        
        if(b == 10)             // if keyword here
        {
            System.out.println("What a pleasant surprise..!!");
        }
        else                    // else keyword here
        {
            System.out.println("What..??");
        }
        
    }
}

When the above Java program is compile and run, it will produce the following output:

java keywords

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test