Written by - Yash Agrawal

Java Keywords


Java keywords is also known as reserved keywords, they are words which are predfined and every keyword has a perticular meaning and usage, they cannot be used as a variable or object name or class name.

List of Java Keywords:

  1. boolean: Java boolean is the used to declare variable of boolean data type, which holds True or False.
  2. abstract: abstract is used to declare an abstract class. An abstract class can provide the implementation of Interface.
  3. break: This keyword is used in loops to break the flow, it is also used with switch statements.
  4. case: Java case keyword is used with the switch statements to mark blocks of text.
  5. byte: Java byte keyword is used to declare a variable that can hold 8-bit data values.
  6. catch: Java catch keyword is used to catch the exceptions generated by try statements. It must be used after the try block only.
  7. char: Java char keyword is used to declare a variable that can hold unsigned 16-bit Unicode characters.
  8. continue: Java continue keyword is used to continue the loop. It continues the current flow of the program and skips the remaining code at the specified condition.
  9. class: Java class keyword is used to declare a class.
  10. default: Java default keyword is used to specify the default block of code in a switch statement.
  11. do: Java do keyword is used in the control statement to declare a loop. It can iterate a part of the program several times.
  12. double: Java double keyword is used to declare a variable that can hold 64-bit floating-point number.
  13. else: Java else keyword is used to indicate the alternative branches in an if statement.
  14. enum: Java enum keyword is used to define a fixed set of constants. Enum constructors are always private or default.
  15. extends: Java extends keyword is used to indicate that a class is derived from another class or interface.
  16. final: final keyword is used to restrict user from updating the variable value making it a constant.
  17. finally: Java finally keyword indicates a block of code in a try-catch structure. This block is always executed whether an exception is handled or not.
  18. float: Java float keyword is used to declare a variable that can hold a 32-bit floating-point number.
  19. implements: Java implements keyword is used to implement an interface.
  20. instanceof: Java instanceof keyword is used to test whether the object is an instance of the specified class or implements an interface.
  21. interface: Java interface keyword is used to implement interface which can only have abstract methods.
  22. long: Java long keyword is used to declare a variable that can hold a 64-bit integer.
  23. new: new keyword is used to create new object.
  24. private: Java private keyword is an access modifier. It is used to indicate that a method or variable may be accessed only in the class in which it is declared.
  25. protected: Java protected keyword is an access modifier. It can be accessible within the package and outside the package but through inheritance only. It can't be applied with the class.
  26. public: Java public keyword is an access modifier. It is used to indicate that an item is accessible anywhere. It has the widest scope among all other modifiers.
  27. static: Java static keyword is used to indicate that a variable or method is a class method. The static keyword in Java is mainly used for memory management.
  28. strictfp: Java strictfp is used to restrict the floating-point calculations to ensure portability.
  29. super: Java super keyword is a reference variable that is used to refer to parent class objects. It can be used to invoke the immediate parent class method.
  30. synchronized: Java synchronized keyword is used to specify the critical sections or methods in multithreaded code.
  31. this: Java this keyword can be used to refer the current object in a method or constructor.
  32. transient: Java transient keyword is used in serialization. If you define any data member as transient, it will not be serialized.
  33. volatile: Java volatile keyword is used to indicate that a variable may change asynchronously.