Oct 11, 2014

List of all keywords and reserved words in java

Java Keywords

What is a keyword? Keyword is a special word/reserved word which is already defined in the compiler. We can not use keywords in our program for declaring any variable or program name or in other declarations. Keywords definition is defined in the compiler.
For example, If you try to declare a variable with name 'try' that is not possible as 'try' is a keyword in java language. See following example.
  
  class Testpgm
 {
    int try; //this variable can not be declared....
    public static void main(String[] args) 
   {
       //class code....  
   }  
} 
Below is lists of all Java keywords-
There are 53 keywords in java.
1. 48 special words.
2. 3 special words.
3. 2 unused words.

2 unused keywords
================
1. goto
2. const

3 reserve words
===============
1. null
2. true
3. false

48 special words
================

keywords for flow control
==========================
1. if
2. else
3. do
4. while
5. for
6. return
7. switch
8. case
9. continue
10.break
11.default

keywords for Exception Handling
===============================
12.try
13.catch
14.finally
15.throws
16.throw
17.assert

keywords for Access specifier
==============================
18.public
19.protected
20.private 

keywords for Access modifier
=============================
21.static
22.final
23.abstract
24.synchronized
25.transient
26.strictfp
27.native
28.volatile 

keywords for classes 
====================
29.class
30.interface
31.enum
32.package
33.import 

keywords for object 
===================
34.this
35.super
36.instance of
37.extends
38.implements
39.new 

Keywords for data type 
======================
40.byte
41.short
42.int
43.long
44.float
45.double
46.char
47.boolean
48.void