Variables act as containers that store data. There are three types of variables in Java: static variables defined with the static keyword but declared like instance variables, local variables confined within a method, and instance variables defined outside methods in a class.
3. Learn About
Variables:
Variables act like containers that keep and store
your data. As Java is statically typed, its important
to first declare a variable before we start using it.
4. In Java there are three types of variables;
Static variable: the keyword here is static but its
defined the same way as the instance variable.
Local variable: its confined within the body of the
method
Instance variable: its outside any block or method
and it's defined in a class.