This repository contains simple and beginner-friendly Java programs based on Arrays.
It is designed to help students and beginners understand how arrays work in Java —
from declaration and initialization to more advanced operations like sorting, searching, and matrix handling.
- Declaring and Initializing Arrays
- Traversing Arrays
- Finding Minimum and Maximum Elements
- Sorting Arrays
- Searching Elements (Linear & Binary Search)
- Multi-dimensional Arrays (2D Arrays / Matrices)
- Common Array Practice Problems
To provide clear, simple, and easy-to-understand examples that strengthen your understanding of array manipulation and logic building in Java.
git clone https://github.com/<your-username>/Arrays-in-Java.git
cd Arrays-in-Java
2️⃣ Compile the Java file
bash
Copy code
javac FileName.java
3️⃣ Run the program
bash
Copy code
java FileName
💡 Example:
bash
Copy code
javac LinearSearch.java
java LinearSearch
🪄 Example Program
java
Copy code
public class SumOfArray {
public static void main(String[] args) {
int[] arr = {10, 20, 30, 40, 50};
int sum = 0;
for (int num : arr) {
sum += num;
}
System.out.println("Sum of array elements: " + sum);
}
}
🧩 Folder Structure
markdown
💡 Future Additions
Reverse an array
Rotate an array
Remove duplicates
Dynamic input using Scanner
Interactive examples
🧑💻 Author
Khushi Kalwani
💬 “Learning Java, one array at a time!”
⭐ Contribute
Want to add your own array program?
Fork this repo 🍴
Add your file
Open a pull request 🚀
<p align="center"> Made with ❤️ and ☕ in Java </p> ```