Java Programs

This page includes various Java programs covering all the Java topics such as control statements, strings, arrays, loops, classes, functions, matrix, etc. For all the Java programs, we provide multiple examples and the result.

Simple Java Programs

Please visit our Java Tutorial section to learn Java Programming with examples.

  1. Java program to print Hello World
  2. Java program to print an Integer
  3. Java program to add Two Numbers
  4. Java program to add Two Complex Numbers
  5. Java program to find Compound Interest
  6. Java Program to check Number Divisible by 5 and 11
  7. Java Program to find Cube of a Number
  8. Java program to print Even Numbers from 1 to N
  9. Java program to find GCD of a Number
  10. Java Program to find Largest of Two Numbers
  11. Java Program to find largest of Three Numbers
  12. Java program to find LCM of a Number
  13. Java Program to print Multiplication Table
  14. Java program to print Odd Numbers from 1 to N
  15. Java program for Odd or Even
  16. Java program to find Positive or Negative Number
  17. Java program to find Power of a Number
  18. Java program to calculate Profit or Loss
  19. Java program to print 1 to 100 without using Loops
  20. Java program to find Roots of a Quadratic Equation
  21. Java program to find Square of a Number
  22. Java program to find Square Root of a Number
  23. Java program to calculate Simple Interest
  24. Java program to find Sum of Even Numbers
  25. Java program to find Sum of Odd Numbers
  26. Java program to calculate Student Grade
  27. Java program to find Sum of Even and Odd Numbers
  28. Java program to find Total Average and Percentage of Five Subjects
  29. Java program to Multiply Two Numbers
  30. Java program to Create a Simple Calculator
  31. Java program to Compute Quotient and Remainder
  32. Java Permutation and Combination Program

Character Programs in Java

  1. Java program to find ASCII Value of a Character
  2. Java program to find ASCII value of all Characters
  3. Java program to display Alphabets from a to z
  4. Java program to print Alphabets from A to Z
  5. Java program to check Character is Alphabet or Not
  6. Java program to check Character is Vowel or Consonant

Java Number Programs

  1. Java program to check Armstrong Number
  2. Java program to count Digits in a Number
  3. Java Electricity Bill Program
  4. Java program to find Factors of a Number
  5. Java Factorial Program
  6. Java Fibonacci Series
  7. Java program to find First Digit of a Number
  8. Java program to find First and Last Digit of a Number
  9. Java program to find Generic Root of a Number
  10. Java program to find Last Digit of a Number
  11. Java program to print Natural Numbers from 1 to N
  12. Java program to print Natural Numbers in Reverse Order
  13. Java Perfect Number Program
  14. Java Palindrome Program
  15. Java program to check Prime Number or Not
  16. Java program to print Prime Numbers from 1 to N
  17. Java program to find Sum of Prime Numbers from 1 to N
  18. Java program to Reverse a Number
  19. Java program to check Strong Number
  20. Java program to find Sum of Digits in a Number
  21. Java program to find Sum of Natural Numbers from 1 to N
  22. Java program to Swap Two Numbers

Java Area Programs

The following are the list of java programs to find

  1. Java program to find Area of a Circle
  2. Java program to find Area of a Equilateral Triangle
  3. Java program to find Area of a Isosceles Triangle
  4. Java program to find Area of a Parallelogram
  5. Java program to find Area of a Rectangle
  6. Java program to find Area of a Right Angled Triangle
  7. Java program to find Area of a Rhombus
  8. Java program to find Area Of a Triangle
  9. Java program to find Area of a Triangle using base and height
  10. Java program to find Area Of a Trapezoid
  11. Java program to find Angle of a Triangle
  12. Java program to find Diameter, Circumference, and Area of a Circle
  13. Java program to find Perimeter of a Rectangle
  14. Java program to find Perimeter of a Rhombus
  15. Java Program to check Triangle is Equilateral, Isosceles, or Scalene
  16. Java program to check Triangle is valid using Angles
  17. Java program to check Triangle is valid using Sides

Java Volume and Surface Area Programs

The following are the Java programs to find the Surface area and Volume of the given data.

  1. Java program to find Volume and Surface Area of Sphere
  2. Java program to find Volume and Surface Area of a Cylinder
  3. Java program to find Volume and Surface Area of Cube
  4. Java program to find Volume and Surface Area of Cuboid
  5. Java program to find Volume and Surface Area of Cone

Java String Programs

  1. Java program to print Characters in a String
  2. Java program to print ASCII values of String Characters
  3. Java program to concat Strings
  4. Java program to convert Lowercase to Uppercase
  5. Java program to convert Uppercase to Lowercase
  6. Java program to count Total Characters in a String
  7. Java program to count Total Words in a String
  8. Java Counting Alphabets Digits & Special Characters in a String
  9. Java program to count Vowels and Consonants in a String
  10. Java program to count Total Occurrence of Character in a String
  11. Java program to find All Occurrences of a Character in a String
  12. Java program to find First Character Occurrence in a String
  13. Java program to find Last Character Occurrence in a String
  14. Java program to Find Maximum Occurring Character in a String
  15. Java program to Find Minimum Occurring Character in a String
  16. Java program to find Frequency of each Character in a String
  17. Java program to check Palindrome String
  18. Java program to print First and Last Character in a String
  19. Java program to remove All Occurrences of a Character in a String
  20. Java program to remove First and Last Character in a String
  21. Java program to remove First Character Occurrence in a String
  22. Java program to remove Last Character Occurrence in a String
  23. Java program to replace First Character Occurrence in a String
  24. Java program to replace Last Character Occurrence in a String
  25. Java Program to reverse Letters in a String
  26. Java program to reverse a String
  27. Java program to Toggle All Characters in a String
  28. Java program for String Comparison

Java Conversion programs

  1. Java program to Convert Character to String
  2. Java program to Convert Double to String
  3. Java program to Convert Int to Double
  4. Java Program to Convert Int to Long
  5. Java program to Convert Float to String
  6. Java program to Convert String to Character
  7. Java program to Convert String to Double
  8. Java Program to Convert String to Float
  9. Java program to Convert String to Long

Java Date Programs

  1. Java Leap Year Program
  2. Java program to print Number of Days in a Month

Java Array Programs

  1. Java Program to Print Array Elements
  2. Java program to perform Arithmetic Operations on Array
  3. Java program to copy an Array to another
  4. Java program to Count Even Numbers in an Array
  5. Java program to Count Even and Odd Numbers in an Array
  6. Java program to Count Odd Numbers in an Array
  7. Java program to Count Positive Array Numbers
  8. Java program to Count Negative Array Numbers
  9. Java program to Count Positive and Negative Numbers in an Array
  10. Java program to Count Array Duplicates
  11. Java program to Delete Array Duplicates
  12. Java program to print Largest Array Number
  13. Java program to print Largest and Smallest Array Number
  14. Java program to Print Negative Array Numbers
  15. Java program to Print Positive Array Numbers
  16. Java program to Put Positive and Negative Numbers in Separate Array
  17. Java program to print Second Largest Array Number
  18. Java program to print Smallest Array Number
  19. Java program to Sort Array Elements in Ascending Order
  20. Java program to Sort Array Elements in Descending Order
  21. Java program to find Sum of All Elements in an Array
  22. Java program to find Sum of Even Numbers in an Array
  23. Java program to find Sum of Even and Odd Numbers in an Array
  24. Java program to find Sum of Odd Numbers in an Array
  25. Java program to Swap Two Array without using Temp Variable
  26. Java program to print Unique Array Items

Java Matrix Programs

  1. Java Program to Print Matrix Items
  2. Java program to perform Arithmetic operations on Matrix
  3. Java program to Add Two Matrices
  4. Java program to Check Two Matrices are Equal
  5. Java program to Calculate Determinant of a Matrix
  6. Java program to check Identity Matrix
  7. Java program to Interchange Matrix Diagonals
  8. Java program to print Lower Triangle of a Matrix
  9. Java program to Multiply two Matrices
  10. Java program to perform Scalar Matrix Multiplication
  11. Java program to check Sparse Matrix
  12. Java program to Subtract two Matrices
  13. Java program to find Sum of the Matrix Lower Triangle
  14. Java program to find Sum of the Matrix Upper Triangle
  15. Java program to find Sum of Matrix Opposite Diagonal
  16. Java program to find Sum of Matrix Diagonal
  17. Java program to find Sum of each Matrix Column
  18. Java program to find Sum of each Matrix Row
  19. Java program to find Sum of Matrix Rows and Column
  20. Java program to check Symmetric Matrix
  21. Java program to Transpose Matrix
  22. Java program to print Upper Triangle of a Matrix

Java Star Pattern Programs

  1. Java program to print Alphabet A using stars
  2. Java program to print Diamond Star Pattern
  3. Java program to print Downward Triangle Star Pattern
  4. Java program to print Exponentially Increased Star Pattern
  5. Java program to print Half Diamond Star Pattern
  6. Java program to print Hollow Diamond Star Pattern
  7. Java program to print Hollow Diamond Pattern inside a Square
  8. Java program to print Hollow Inverted Pyramid Star
  9. Java program to print Hollow Inverted Right Triangle Star Pattern
  10. Java program to print Hollow Left Pascals Star Triangle
  11. Java program to print Hollow Mirrored Rhombus Star Pattern
  12. Java program to print Hollow Pyramid Star Pattern
  13. Java program to print Hollow Rectangle Star Pattern
  14. Java program to print Hollow Rhombus Star Pattern
  15. Java program to print Hollow Right Angled Triangle Star Pattern
  16. Java program to print Hollow Right Pascals Star Triangle
  17. Java program to print Hollow Square Star Pattern
  18. Java program to print Hollow Square with Diagonals
  19. Java program to print Inverted Mirrored Right Triangle Star Pattern
  20. Java program to print Inverted Pyramid Star Pattern
  21. Java program to print Inverted Right Triangle Star Pattern
  22. Java program to print Left Arrow Star Pattern
  23. Java program to print Left Pascals Star Triangle
  24. Java program to print Mirrored Half Diamond Star Pattern
  25. Java program to print Mirrored Rhombus Star Pattern
  26. Java program to print Mirrored Right Triangle Star Pattern
  27. Java program to print Plus Star Pattern
  28. Java program to Print Pyramid Star Pattern
  29. Java program to print Rectangle Star Pattern
  30. Java program to print Reverse Mirrored Right Triangle Star Pattern
  31. Java program to print Rhombus Star Pattern
  32. Java program to print Right Angled Triangle Star Pattern
  33. Java program to print Right Arrow Star Pattern
  34. Java program to print Right Pascals Star Triangle
  35. Java program to print Sandglass Star Pattern
  36. Java program to print Square Star Pattern
  37. Java program to print X Star Pattern

Java Number Pattern Programs

  1. Java program to print 1 and 0 in Alternative Rectangle Columns
  2. Java program to print 1 and 0 in Alternative Rectangle Rows
  3. Java program to print Box Number Pattern of 1 and 0
  4. Java program to print Consecutive Numbers Right Triangle Columns
  5. Java program to print Consecutive Numbers Right Triangle Rows
  6. Java program to print Diamond Number Pattern
  7. Java program to print Floyd’s Triangle
  8. Java program to print Hollow Box Number Pattern
  9. Java program to print Inverted Right Triangle of Consecutive Numbers
  10. Java program to print Inverted Right Triangle of Decreasing Order Numbers
  11. Java Program to Print Inverted Right Triangle Number Pattern
  12. Java program to print Inverted Right Triangle Numbers in Reverse
  13. Java program to print K Shape Number Pattern
  14. Java program to print Left Pascals Number Triangle
  15. Java program to print Pascal Triangle
  16. Java program to print Right Arrow Number Pattern
  17. Java program to print Right Pascals Number Triangle
  18. Java program to print Right Triangle of 1 and 0
  19. Java program to print Right Triangle Number Pattern
  20. Java program to print Right Triangle of Numbers in Reverse
  21. Java program to print Right Triangle of Incremented Numbers
  22. Java program to print Sandglass Number Pattern
  23. Java program to print Same Numbers on all Sides of a Square
  24. Java program to print Same Numbers in Rectangle Rows and Columns
  25. Java program to print Same Numbers in Square Rows and Columns
  26. Java program to print Square Number Pattern
  27. Java program to print a Simple Number Pattern

Java Alphabet Pattern Programs

  1. Java program to print K Shape Alphabets Pattern
  2. Java program to print Repeated Character Pattern
  3. Java program to print Right Triangle Alphabets Pattern
  4. Java program to print Triangle Alphabets Pattern

Comments are closed.