Lab Manual — Arrays
Topic: Array Manipulation in Java
Subject: Object-Oriented Programming / Introduction to Programming
Level: Beginner to Intermediate
Tasks Covered 5 Solved Tasks
Concepts Arrays, Loops, Methods, Conditionals
Language Java
Format Study Reference / Lab Guide
■ Disclaimer: This document is intended as a study reference and learning guide only. All solutions are original work. Use
responsibly for educational purposes.
, Introduction to Arrays in Java
An array in Java is a data structure that stores a fixed-size collection of elements of the same data
type. Arrays allow us to store multiple values in a single variable and access them using an index
starting from 0.
Concept Description
Declaration int[] array = new int[5];
Initialization int[] array = {1, 2, 3, 4, 5};
Accessing Elements array[0] → first element, array[4] → fifth
Array Length array.length returns number of elements
Looping through Array Use for loop: for(int i=0; i < array.length; i++)