Data types and Variables in Java
Variable is a memory location in a program.There are three types of variables that a Java program can have.
Variables can be changed, i.e., they can be varied.We can define variable also as a reserved memory location.
Types of Variables in Java
As I mentioned earlier, there are three kinds of variables in Java.
variables in Java
It’s a variable which has been declared inside a method.This variable cannot be accessed outside the method.
These are variables declared outside a method but inside a class.
These are variables declared with static keyword, and they can never be local variables.
Data Types in Java
Data types are different values that can be assigned a memory location, i.e., a variable.Two data types in Java are.
1.Primitive data type
2.Non-primitive data types