What are Identifiers in Java?

Any name (class name,variable name , method name and label name) in java program is called an identifier.
e.g. int number = 10;
Here, number is an identifier.

Given the below class HelloWorld.java , List all the identifiers :

1 package com.masterjavatutorial;
2 public class HelloWorld {
3
4	public static void main(String[] args) {
5
6		 String name = "Mohan";
7	}
8
9 }

In the above Program , the identifiers are as below :
In Line 2 — HelloWorld
In Line 4 — main , String[] , args
In Line 6 — String , name

So, in total there are 6 identifiers in the above given program.

Leave a Reply