0% found this document useful (0 votes)
0 views1 page

Arrays - Variables

Uploaded by

hanielangwi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views1 page

Arrays - Variables

Uploaded by

hanielangwi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

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.

A local variable cannot be defined with "static" keyword.

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.

It is called an instance variable because its value is instance-specific and is not


shared among instances.

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.

You might also like