HomeJavaJava – Keywords & Identifiers

Java – Keywords & Identifiers


Keywords/Reserved words are predefined, reserved words used in Java programming which have been described to the Java compiler already. We cannot use a keyword as a variable name or an identifier, as they are predefined in Java and using them will throw error.

For example:

int value1;

Here, ‘int’ is a keyword. It indicates that the variable ‘value1’ (which is a identifier) is of integer type.

Here’s the complete list of all keywords in Java programming.


In total there are 50 + 03 (literals) keywords/reserved in Java.

Let us see in detail on some of the keywords and their functions in Java.

  • break: It is used inside a loop to bring the program control out of the loop or to terminate the loop immediately.
  • continue: The ‘continue statement’ in a loop ends the current iteration and forces the next iteration to take place bypassing any other statements inside.
  • switch: The ‘switch’ keyword is used to perform a block of statements that is when you have to execute a different task for each choice.
  • int: Keyword ‘int’ declares the data type integer. char: This keyword ‘char’ declares a character variable.
  • if…else: In Java programming, the if and else are conditional statements used in decision making.
  • goto: It is used when you have to transfer the program control to a particular label.
  • return: The keyword ‘return’ terminates the function and returns a value.
  • void: ‘Void’ means no value or null.


The names given to constants, variables, functions and user-define data are known as Identifiers. It is assigned by the user in the program.

There are a set of rules to frame an Identifier.

  • An identifier can be of alphanumeric values only i.e letters and digits. (A-Z, a-z, 0-9)
  • Underscore _ can be used in an identifier.
  • Identifier names must be unique.
  • Keywords/Reserved words cannot serve as an Identifier.
  • No special character is allowed.
  • The first character of an identifier must be an alphabet or underscore.
  • Identifiers are case-sensitive.
  • sNo white spaces are allowed.

Examples for identifiers:


Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Java is a popular programming language that is used to develop a wide range of applications. If you are a...
  • Java
  • March 6, 2023
Java is a programming language and computing platform that is used to create various types of applications. It is used...
  • Java
  • March 6, 2023
In this post, you’ll learn how to download and install JUnit in Eclipse so that you can use in your...
  • Java
  • October 9, 2022