Class 12 Java Project File
Student Name: ____________________________
Roll Number: ____________________________
Introduction
This project file contains 20 Java programs covering fundamental and advanced concepts of Java programming,
including object-oriented principles, data structures, file handling, exception management, and GUI development.
The programs are designed to help Class 12 students understand the practical applications of Java, improve
coding skills, and prepare for board practical examinations. Each program is well-commented for clarity.
Index
1. Hello World Program
2. Prime Number Checker
3. Fibonacci Series
4. Factorial Calculation
5. Palindrome Checker
6. Armstrong Number Checker
7. Matrix Addition
8. Bubble Sort
9. Binary Search
10. File Copy Operation
11. Student Class with Inheritance
12. Method Overloading
13. Abstract Class Example
14. Interface Example
15. Exception Handling Demo
16. Multithreading Example
17. Synchronization Example
18. Simple GUI using Swing
19. Applet Example
20. ArrayList Demonstration
Hello World Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Prime Number Checker
import java.util.Scanner;
public class PrimeChecker {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number: ");
int num = sc.nextInt();
boolean isPrime = true;
if (num <= 1) isPrime = false;
for (int i = 2; i <= Math.sqrt(num); i++) {
if (num % i == 0) {
isPrime = false;
break;
}
}
System.out.println(num + " is " + (isPrime ? "a prime number." : "not a prime number
sc.close();
}
}