Java Programs

Here is a big collection of important Java programs with output. These Java programs will help you in learning different concepts like Class, Object, Package, Inheritance, Interface, Polymorphism, Encapsulation, Abstraction, Multithreading, etc.


java programs


The most globally used programming language is Java. It is used to create all kinds of applications for businesses, web development, mobile applications, enterprise software, and more. There are a variety of Java programs that can be used for different purposes.



1. Hello World in Java
2. Command Line User Input in Java
3. Add two Numbers
4. Add two Numbers by user input
5. Area of Circle
6. Area of Rectangle
7. Area of Triangle
8. Calculator in Java
9. Average of Numbers
10. Generate Random Number
11. Calculate Simple Interest
12. Calculate Compound Interest in Java
13. Largest of three numbers in Java
14. Swap Two Numbers in Java
15. Swap Two Numbers Without Using Third Variable in Java




1. Even or Odd Program in Java
2. Check Leap Year in Java
3. Largest of three numbers in Java
4. Find Season of Month in Java




1. Factorial of a Number in Java
2. Factorial of Large Number in Java
3. Sum of digits of a number in Java
4. Reverse the Number in Java
5. Armstrong Number Program in Java
6. Multiplication Table in Java
7. Number Palindrome in Java
8. Fibonacci Series in Java
9. Check Prime Number in Java
10. Print Prime Numbers List upto n
11. HCF and LCM in Java
12. Floyd’s triangle program in Java
13. Binary to Decimal in Java
14. Print Multiplication Pyramid table in Java




1. Array Input in Java
2. Sum and Average of Array in Java
3. Find Largest and Smallest Number in Array
4. Find Second Largest Number in Array
5. Sort Array in Java
6. Linear Search
7. Binary Search
8. Bubble Sort
9. Addition of Two Matrix in Java
10. Matrix Multiplication in Java
11. Transpose Matrix in Java




1. Find String Length in Java
2. String Palindrome in Java
3. Reverse String in Java
4. Reverse a Sentence in Java
5. Find substrings of a string in Java
6. Count number of Vowels in a String
7. Sort Strings in an Alphabetical Order



Sum of Series

1. Sum of Harmonic Series in Java 1 + 1/2 + 1/3 + 1/4 + ……+ 1/n
2. Find the sum of series in Java 1+(1+2) + (1+2+3) +… (1+2+3+…n)




1. Simple Calculator Program using Java Swing
2. Area Calculator Program using Java AWT




StringBuffer and StringBuilder in Java?




More Java Programs will be added soon……





Scroll to Top