BlogPost

November 22, 2025

Java Top 30 Programs - For EXAMS ( VIVA / Practical )

 

BASIC (Mostly Practice in LABS)

1. Hello World / Basic I/O Program

  • Simple input output using Scanner.

2. Check Even or Odd

  • Number system basics.

3. Check Prime Number

  • Most repeated program.

4. Fibonacci Series

  • Iterative + Recursive (viva favourite).

5. Factorial of a Number

  • Iterative + Recursive.

6. Palindrome Number 

  • Reverse number logic. ( 121, 11, 99 )

7. Armstrong Number

  • 153 → 1³ + 5³ + 3³ = 153.

8. Reverse a Number

  • Loop + logic building.

9. Sum of Digits

  • Simple while loop.

10. Swap Two Numbers

  • With third variable + without third variable.


Strings (Most Asked in Viva)

11. Check Palindrome String

  • Very common.

12. Count Vowels & Consonants in String

13. Reverse a String

  • Without using inbuilt methods.

14. Find Frequency of Characters in String

  • Interview-level logic.

15. Remove Whitespaces From String


Arrays (High Scoring Questions)

16. Find Largest & Smallest in Array

17. Sort Array

  • Bubble sort (most asked)

  • Selection sort

  • Insertion sort

18. Linear Search & Binary Search

  • Binary search viva favourite.

19. Merge Two Arrays

20. Find Duplicate Elements in Array


Object-Oriented Concepts (Internal Examiner Loves This)

21. Program to Demonstrate Class & Object

22. Inheritance Example

  • Single + Multilevel.

23. Method Overloading & Overriding Program

24. Abstract Class Example

25. Interface Example

  • Multiple inheritance via interface.


Exception Handling & File Handling

26. Try–Catch Demo Program

  • Divide by zero.

27. Custom Exception Program

28. Read/Write File in Java

  • Using FileInputStream & FileOutputStream.


Collections (New Syllabus Trend)

29. ArrayList Operations

  • Add, remove, update, iterate.

30. HashMap Example

  • Key-value basic operations.


🎯 Bonus Programs (Frequently Asked in External Viva)

  • Prime numbers in a range

  • Matrix addition

  • Matrix multiplication

  • Pattern printing (star patterns)

  • Calculator using switch

  • Sort names alphabetically

  • Bank Account OOP mini-task

  • Thread creation program

Share


©CodingWallah. All Rights Reserved by CodingWallah