Sunday, 22 January 2017

KEYWORDS IN JAVA

Why Keywords - To communicate between program and developer. As a developer if we want to interact with any programming languages then that programming language has to provide some instruction for communication then that instructions are Keyword (reserved words).

In java we have 50 keywords.

Keyword list in java

1. primitive datatypes //9

  • byte
  • short
  • int
  • long
  • float
  • double
  • char
  • boolean
  • void (non return datatype)
2. Control statement //11
  • if
  • else
  • switch
  • case
  • break
  • default
  • while
  • do
  • for
  • continue
  • return
3. Access specifier / modifier // 4-1 = 3
  • private
  • public 
  • protected
  • default (default already mentioned above)
4. Class level keywords //4
  • class
  • abstract
  • interface
  • enum
5. Inheritance keywords //2
  • extends
  • implements
6. Referential keywords //3
  • this
  • super
  • static
7. Constatnt requirement keywords // 3-1=2
  • final
  • static (static already mentioned above)
  • strictfp
8. Package creation keywords //2
  • package
  • import
9. Blocks in java //2-1=1
  • static (static already mentioned above)
  • synchronized
10. Unused keywords //2
  • goto
  • const
11. Exception handling //5
  • try
  • catch
  • finally
  • throw
  • throws
12. Testing operation //1
  • assert
13. Calling other programming language implementation //1
  • native
14. Object creation keywords //2
  • new
  • instanceof
15. Serialization variable
  • transient
  • volatile
Note : true, false and null are not keywords it is literals.

According to Oracle documentation we have 50 keywords from that const. goto are reserved in java but currently we are not using due to some advanced concepts.

No comments:

Post a Comment