- JAVA OVERVIEW
- History of Java
- Tools you will need for java
- Java Environment Setup
- Popular Java Editors
- Java Basic Syntax/First-Program
- Java Identifiers
- Java Modifiers
- Java Arrays
- Java Enums
- Java Keywords
- Comments in Java
- Java - Objects and Classes
- Objects in Java
- Classes in Java
- Constructors
- Creating an Object
- Accessing Instance Variables and Methods
- Source file declaration rules
- Java Package
- Simple Case Study
- Basic Data Types
- Primitive Data Types
- Reference Data Types
- Java Literals
- Variable Types
- Local variables
- Instance variables
- Class or static variables
- Java Access Modifiers
- What is OOPS
- Inheritance concept
- Encapsulation
- What is Polymorphism
- Method Overloading
- Method Overriding
- Abstraction in Java
- Abstract class
- Interface in Java
- Method overloading in Java:
- What is Annonymous object?
- Java 8
What are Java Arrays ?
Arrays are objects that store multiple variables of the same data type. However, an Array itself is an object on the heap.
We define the variable type with square brackets: like String studentNames[];
Here, we have declared String type Student Name in array
An array is a collection of homogenous(similar type) collection of elements which have a contiguous memory location.
We can store only a fixed number of elements in an array.
It is based on index. Indexing always starts from 0 and goes to length-1.
Arrays are used to store multiple values of same datatype in a single variable, instead of declaring separate variables for each value.
Program 1:-
public class ArraysExample
{
public static void main(String[] args)
{
String[] friends = {"Heera", "Navneet", "Sajan", "Sourav"};
for (int i = 0; i < friends.length; i++)
{
System.out.println(friends[i]);
}
}
}