Arrays - Variables
Arrays - Variables
Arrays are a data structure that stores a fixed-size sequence of elements of the
same type. They allow for efficient storage and retrieval of multiple values using
a single variable.
2. The class data type represents a class in Java. It is used to create objects and
define their behavior.
3. Interfaces
The interface keyword is used to declare an interface .Total abstraction (hiding)
is offered, which means that all methods in an interface are declared with an empty
body and that all fields are by default public, static, and final.
4. Enums
The Enum data type represents an enumeration (list) type. It is used to define a
fixed set of named values, such as days of the week or colors.
1) Local Variable
A variable declared inside the body of the method is called local variable. You can
use this variable only within that method and the other methods in the class aren't
even aware that the variable exists.
2) Instance Variable
A variable declared inside the class but outside the body of the method, is called
an instance variable. It is not declared as static.
3) Static variable
A variable that is declared as static is called a static variable. It cannot be
local. You can create a single copy of the static variable and share it among all
the instances of the class. Memory allocation for static variables happens only
once when the class is loaded in the memory.