In this tutorial, we will learn about Keywords in Java. Java provides a wide range of keywords to us. Every keyword has some special meaning in Java. We can not use any keyword as class name or as a variable name.

All keywords have some predefined meaning which Java compiler knows very well for example if you are using ” while ” keyword then compiler know very well that we are going to define a loop. Like other programming languages, Java has some common keywords like if, for. But it also has some special keywords like byte, implements.

It’s important to note we can not use any keyword as the name of an identifier (as a class name, variable name or method name.)

Keyword List in Java: –

  • abstract: – We use abstract keyword with the class to make a class abstract. We can not create an instance of abstract class
  • boolean: – We use boolean keyword with a variable to define a variable of the boolean data type. boolean is a special kind of data type in Java and boolean variable can hold only two values(true/false).
  • break: – break keyword is used to break the normal flow of statement we normally use this keyword with switch but we can also use this with if statement.
  • byte: – byte keyword is used to define a variable of the byte data type. The byte is a special kind of data type in Java which can store 8-bit numeric value.
  • case: – case keyword we used in a switch statement to define different cases of the switch statement.
  • catch: – catch keyword we use with try keyword and it helps us in Exception handling.
  • char: – char keyword we use with a variable to define a variable of the char data type.
  • class: – class keyword used to create a class.
  • do: – do keyword is used to define the do-while loop in Java.
  • double: – double keyword is used to define a variable of the double data type.
  • else: – else keyword we use with if keyword, we use this keyword to define negative part of if statement.
  • extends: – we use extends keyword to perform inheritance in Java in simple words to get features of one class into another class.
  • final: – final keyword is used to define constant in Java, to define a non-override able method in Java and to define the final class in Java.
  • finally: – we use finally keyword to define finally block in exception handling.
  • float: – float keyword is used to define the variable of float data type in Java.
  • for: – for a keyword is used to define loop in Java.
  • if: – if is a keyword used to define conditional statement in Java.
  • implements: – implements keyword is used to inherit an interface in a class.
  • import: – import keyword is used to import a complete package or a class in the program.
  • int: – int keyword is used to define a variable of int data type in Java.
  • interface: – interface keyword is used to define an interface in Java.
  • long: – long keyword is used to define the variable of long data type in Java.
  • new: – new keyword is used to create a new object of the class.
  • package: – package keyword is used to define package in Java.
  • private: – private keyword is used as the access specifier of class, variable or method.
  • protected: – protected keyword is also used as the access specifier of class, variable or method.
  • return: – return keyword is used to return some value back after the execution of the method.
  • short: – short keyword is used to define the variable of the short data type.
  • static: – static keyword is used to define a static variable, static methods and static blocks in Java. This keyword is mainly used for memory management
  • super: – super keyword is like a reference variable and super keyword references to the object of the parent class.
  • switch: – switch keyword is used to define switch statement in the program it is part of control flow.
  • this: – this keyword is like a reference variable and this keyword references to the object of the current class.
  • throw: – throw keyword is used in Exception handling. it uses to throw explicitly Exception in program
  • throws: – throws keyword is used in Exception handling. A checked exception can be propagated with throws.
  • try: – try keyword is used in mention part of code where an exception may occur in the program.
  • void: – void keyword is used in to define the return type of function in Java. The void mean function will return nothing.
  • while: – while keyword is used to define a while loop in Java.