Course Content

If you are facing any issue in playing video please use Firefox browser.

Course Content

Description

Java Identifiers

From our previous video we have learn that what are Data types in Java, and it’s different types. In this video we are going to see that what are Java Identifiers.

In Java an Identifier is a name given to a variable, class, or method. Identifiers of Java start with a letter (a-z), underscore(_) or dollar sign($). Identifiers are case-sensitive and have no maximum length. For example - userName, user_name, _sys_var1, $change.

After Identifiers in Java, there are Variables in Java. A Java variable is a piece of memory that can contain a data value. Thus a variable has a data type.

Variables in Java are divided into three different types. They are Local, Instance, and Static.

A variable that is declared inside the method is called Local variable. And a variable that is declared inside the class but outside the method is called instance variable. While the variable that is declared as static is called Static variable. It cannot be local.

Now we will do programming for local variable.
class abc
{
void abc()
{
int a=2;
System.out.printIn("local variable" + "\n"+a);
}
public static void main(String args[])
{
abc a1=new abc();
a1.abc();
}

Now we will compile this program in command prompt and as soon as we do that we can see the local variable and value of integer a=2.

Now we will do programming for instance variable.
class student
{
int id;
String name;
Student (int i, String n)
{
id=i;
name=n;
}
void display()
{
System.out.println(id+" "+name);
}
public static void main (String args[])
{
Student e1=new Student(1,"hiral");
e1.display();
}

Now we will compile this program in command prompt and as soon as we compile we can see the student details we added.

Now we will do programming for static variable.
class std
{
int rollno;
String name;
static String college="ITS";
std(int r, String n)
{
rollno=r;
name=n;
}
void display()
{
System.out.println(rollno+" "+name+" "+college);
}
public static void main(String args[])
{
std s1=new std(1,"akki");
std s2=new std(1,"sanju");
s1.display();
s2.display();
}
Output :
1 akki ITS
2 sanju ITS

Hence, we have seen that what are Identifiers in Java programming language, and also what are the different variables in Java. In the succeeding video we will see what is Array in Java and learn about it in detail.

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere