DEV Community

Hamid Mohamadi
Hamid Mohamadi

Posted on

Lesson 4 : Variables In Java

A Java variable is a piece of memory that can contain a data value . A variable thus has a data type . Variables are typically used to store information which your Java program needs to do it's job .

Variables :

1- local

2- instance

3- static

Alt text of image

Variables have some attributes that you can see in the picture below :

Alt text of image

Notice the example below that use static and instance variables :

Alt text of image

Top comments (0)