Variable is a named representation of a memory location. In simple, you need to store a value in some memory location, that is hard to remember or to reuse. variables are used to represent that memory location.

Ex: int a=10;
in the above line of code, a is a variable, that represents a memory location where the value 10 is stored.

Java is a strongly typed language, it means, all the values must be specified with any of the predefined types, such as Integer, and values can also be modified later.

Ex: 
int x=20; // strongly Typed
x=15 // Weakly Typed, no need to mention the data type here.

Python, JavaScript are examples of loosely typed languages.


Naming Convention in Java

Naming of variables is a combination of Rules and Conventions, Java uses Camel Case to represent methods.

Variables in Java

1. Use only Letter, Numbers, $ and _ (Underscore).
2. First Character is not a number or $ or _ and it is always a letter.

Class and Interface Names in Java

Class name and interface name is a noun in java and it must start with a Capital Letter.

Ex:
class Demo{
}
class DemoCode{   // All subsequent words starting letter is a capital

}


Method Names in Java:

Method names in java must start with a small letter and capital letters for all other subsequent words.

Ex:
void programming(int value); // First letter is small
void programmingWebsite(int value); // first letter is small, subsequent word starting letter is capital.

Constant Variables in Java:

All the constants in java must be Capital representation. 

Ex:
public static int MAX_PRIORITY=10;
public static int NORM_PRIORITY = 5;
public static int MIN_PRIORITY=1;

Package Name in Java:

all the package names in java are in lower case letters

Ex:
java.lang
java.io

Example Java Code for Variables:

public class Main {
    public static void main(String args[]) {
        int varName;

        varName = 100;
        System.out.println(varName);

    }

 for more java programs visit https://www.programming9.com/programs/java