Java Programs

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

Simple Java Programs

Before going through these java programming examples, please visit our Java Tutorial section to learn Java Programming with examples.

  1. Java Programs to print Hello World
  2. Java Programs to Get Input from User
  3. Java program to print an Integer
  4. Java Program to Read Integer Value from the Standard Input
  5. Java program to add Two Numbers
  6. Java program to add Two Complex Numbers
  7. Java program to find Compound Interest
  8. Java Program to check Number Divisible by 5 and 11
  9. Java Program to find Cube of a Number
  10. Java program to print Even Numbers from 1 to N
  11. Java program to find GCD of a Number
  12. Java Program to find Largest of Two Numbers
  13. Java Program to find largest of Three Numbers
  14. Java Program to find the Average of Three Numbers
  15. Java Program to find the Smallest of Three Numbers
  16. Java program to find LCM of a Number
  17. Java Program to print Multiplication Table
  18. Java program to print Odd Numbers from 1 to N
  19. Java Programs for Odd or Even
  20. Java Programs to find Positive or Negative Number
  21. Java program to find Power of a Number
  22. Java program to calculate Profit or Loss
  23. Java program to print 1 to 100 without using Loops
  24. Java program to find Roots of a Quadratic Equation
  25. Java program to find Square of a Number
  26. Java program to find Square Root of a Number
  27. Java Program to find Square Root of a Number without sqrt
  28. Java program to calculate Simple Interest
  29. Java program to find Sum of Even Numbers
  30. Java program to find Sum of Odd Numbers
  31. Java program to calculate Student Grade
  32. Java program to find Sum of Even and Odd Numbers
  33. Java Programs to find Total Average and Percentage of Five Subjects
  34. Java program to Multiply Two Numbers
  35. Java Program to Multiply Two Floating Point Numbers
  36. Java program to Create a Simple Calculator
  37. Java program to Compute Quotient and Remainder
  38. Java Permutation and Combination Program
  39. Java Random Number Generator
  40. Java Program to Print First 10 Even Natural Numbers
  41. Java Program to Print First 10 Natural Numbers
  42. Java Programs to Print First 10 Natural Numbers in Reverse
  43. Java Programs to Print First 10 Odd Natural Numbers

Java Programs on Characters

  1. ASCII Value of a Character
  2. ASCII value of all Characters
  3. Display Alphabets from a to z
  4. Print Alphabets from A to Z
  5. Check Character is Alphabet or Not
  6. Check Character is Vowel or Consonant

Java Programs on Numbers

  1. Add Two Binary Numbers
  2. check Armstrong Number
  3. Check Peterson Number
  4. Check Spy Number
  5. Check Sunny Number
  6. Check Tech Number
  7. count Digits in a Number
  8. Electricity Bill
  9. find Factors of a Number
  10. Factorial
  11. Fibonacci Series
  12. Generate Random Numbers
  13. Break Integer into Digits
  14. find First Digit of a Number
  15. find First and Last Digit of a Number
  16. find Generic Root of a Number
  17. find Last Digit of a Number
  18. Print Natural Numbers from 1 to N
  19. Print Natural Numbers in Reverse Order
  20. Perfect Number
  21. Palindrome
  22. Prime Number or Not
  23. Print Prime Numbers from 1 to N
  24. Print first 100 Prime Numbers
  25. Find Sum of Prime Numbers from 1 to N
  26. Reverse a Number
  27. Strong Number
  28. Sum of Digits in a Number
  29. Sum of Natural Numbers from 1 to N
  30. Swap Two Numbers
  31. Get the IP address
  32. Arithmetic Sum using Method Overloading

Java Area Programs

The following are the list of java programs to find

  1. Area of a Circle
  2. Area of a Equilateral Triangle
  3. Area of a Isosceles Triangle
  4. Area of a Parallelogram
  5. Area of a Rectangle
  6. Area of a Right Angled Triangle
  7. Area of a Rhombus
  8. Area Of a Triangle
  9. Area of a Triangle using base and height
  10. Area Of a Trapezoid
  11. Area of Geometric Figures using Method Overloading
  12. Angle of a Triangle
  13. Diameter, Circumference, and Area of a Circle
  14. Perimeter of a Rectangle
  15. Perimeter of a Rhombus
  16. Check Triangle is Equilateral, Isosceles, or Scalene
  17. Check Triangle is valid using Angles
  18. Check Triangle is valid using Sides

Java Programs on Volume and Surface Area

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

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

Java Programs on Strings

  1. Java Tutorial
  2. Java Programs to print Characters in a String
  3. ASCII values of String Characters
  4. concat Strings
  5. convert Lowercase to Uppercase
  6. convert Uppercase to Lowercase
  7. count Total Characters in a String
  8. count Total Words in a String
  9. Count Alphabets Digits & Special Characters in a String
  10. Count Vowels and Consonants in a String
  11. Count Total Occurrence of Character in a String
  12. All Occurrences of a Character in a String
  13. First Character Occurrence in a String
  14. Last Character Occurrence in a String
  15. Maximum Occurring Character in a String
  16. Minimum Occurring Character in a String
  17. Find Frequency of each Character in a String
  18. Palindrome String
  19. print First and Last Character in a String
  20. remove All Occurrences of a Character in a String
  21. remove First and Last Character in a String
  22. remove First Character Occurrence in a String
  23. remove Last Character Occurrence in a String
  24. remove all whitespaces from a String
  25. replace First Character Occurrence in a String
  26. replace Last Character Occurrence in a String
  27. reverse Letters in a String
  28. reverse a String
  29. String Reverse using Recursion
  30. Toggle All Characters in a String
  31. String Comparison
  32. Sort Strings in Alphabetical Order

Java Programs on Conversions

  1. Convert Binary To Decimal
  2. Convert Binary To Octal
  3. Convert Celsius To Fahrenheit
  4. Convert Centimeters To Meters and Kilometers
  5. Convert Character to Int
  6. Convert Character to String
  7. Convert Character Array To String
  8. Convert Decimal To Binary
  9. Convert Decimal To Octal
  10. Convert Double to String
  11. Convert Fahrenheit To Celsius
  12. Convert Float to String
  13. Convert Int to Char
  14. Convert Int to Double
  15. Convert Int to Long
  16. Convert Int to String
  17. Convert Kilometers To Miles
  18. Convert Kilometers To Meters Centimeters and Millimeters
  19. Convert Long to Int
  20. Convert Long to String
  21. Convert Miles To Kilometers
  22. Convert Octal To Binary
  23. Convert Octal To Decimal
  24. Convert String to Character
  25. Convert String to Double
  26. Convert String to Float
  27. Convert String to Int
  28. Convert String to Long

Java Programs on Dates

  1. Convert String to Date
  2. find Leap Year
  3. Print Number of Days in a Month
  4. Measure Elapsed Time

Java Programs on Array

  1. Print Array Elements
  2. Arithmetic Operations on Array
  3. Copy an Array to another
  4. Count Occurrence of an Element in an Array
  5. Count Even Numbers in an Array
  6. Count Even and Odd Numbers in an Array
  7. Count Odd Numbers in an Array
  8. Count Positive Array Numbers
  9. Count Negative Array Numbers
  10. Count Positive and Negative Numbers in an Array
  11. Count Array Duplicates
  12. Count Frequency of each Element in an Array
  13. Calculate Average of an Array
  14. Delete Array Duplicates
  15. Increment All Elements of an Array by One
  16. Largest Array Number
  17. Largest and Smallest Array Number
  18. Negative Array Numbers
  19. Positive Array Numbers
  20. Put Positive and Negative Numbers in Separate Array
  21. Second Largest Array Number
  22. Smallest Array Number
  23. Sort Array Elements in Ascending Order
  24. Sort Array Elements in Descending Order
  25. Sum of All Elements in an Array
  26. Sum of Even Numbers in an Array
  27. Sum of Even and Odd Numbers in an Array
  28. Sum of Odd Numbers in an Array
  29. Reverse an Array
  30. Swap Two Array without using Temp Variable
  31. Unique Array Items
  32. Print Kth element in an Array
  33. Number of Elements in an Array

Java Programs on Matrix

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

Java Programs for Sorting & Searching

  1. Bubble Sort on Integers
  2. Bubble Sort in Descending Order
  3. Java Programming examples to perform Bubble Sort on Strings
  4. Java Programming examples to perform Binary Search
  5. Java Programming examples to perform Linear Search
  6. Java Programming examples to perform Selection Sort

Java Programs on Star Pattern

  1. Alphabet A
  2. Christmas Tree
  3. Diamond
  4. Downward Triangle
  5. Exponentially Increased Star Pattern
  6. H Star Pattern
  7. Half Diamond
  8. Hollow Diamond Star Pattern
  9. Hollow Diamond Pattern inside a Square
  10. Hollow Inverted Pyramid Star
  11. Hollow Inverted Right Triangle Star Pattern
  12. Hollow Left Pascals Star Triangle
  13. Hollow Mirrored Rhombus Star Pattern
  14. Hollow Pyramid Star Pattern
  15. Hollow Rectangle Star Pattern
  16. Hollow Rhombus Star Pattern
  17. Hollow Right Angled Triangle Star Pattern
  18. Hollow Right Pascals Star Triangle
  19. Hollow Sandglass Star Pattern
  20. Hollow Square Star Pattern
  21. Hollow Square with Diagonals
  22. Inverted Mirrored Right Triangle Star Pattern
  23. Inverted Pyramid Star Pattern
  24. Inverted Right Triangle Star Pattern
  25. Left Arrow Star Pattern
  26. Left Pascals Star Triangle
  27. Mirrored Half Diamond Star Pattern
  28. Mirrored Rhombus Star Pattern
  29. Mirrored Right Triangle Star Pattern
  30. Plus Star Pattern
  31. Pyramid Star Pattern
  32. Rectangle Star Pattern
  33. Reverse Mirrored Right Triangle Star Pattern
  34. Rhombus Star Pattern
  35. Right Angled Triangle Star Pattern
  36. Right Arrow Star Pattern
  37. Right Pascals Star Triangle
  38. Sandglass Star Pattern
  39. Square Star Pattern
  40. V Star Pattern
  41. Inverted V Star Pattern
  42. W Star Pattern
  43. X Star Pattern
  44. 8 Star Pattern

Java Programs for Number Pattern

  1. 1 and 0 in Alternative Rectangle Columns
  2. 1 and 0 in Alternative Rectangle Rows
  3. Box Number Pattern of 1 and 0
  4. Consecutive Numbers Right Triangle Columns
  5. Consecutive Numbers Right Triangle Rows
  6. Diamond Number Pattern
  7. Downward Triangle Mirrored Numbers
  8. Floyd’s Triangle
  9. Hollow Box Number Pattern
  10. Inverted Right Triangle of Consecutive Numbers
  11. Inverted Right Triangle of Decreasing Order
  12. Inverted Right Triangle
  13. Inverted Right Triangle Numbers in Reverse
  14. K Shape Number Pattern
  15. Left Pascals Number Triangle
  16. Left Arrow Numbers
  17. Pascal Triangle
  18. Pyramid Numbers Pattern
  19. Right Arrow Number Pattern
  20. Right Pascals Number Triangle
  21. Right Pascals Triangle of Multiplication Numbers
  22. Right Pascals Triangle of Mirrored Numbers
  23. Right-Triangle of 1 and 0
  24. Right-Triangle Number Pattern
  25. Right-Triangle of Numbers in Reverse
  26. Right-Triangle of Incremented Numbers
  27. Right-Triangle of Mirrored Numbers Pattern
  28. Right-Triangle of Numbers in Sine Wave
  29. Right-Triangle of Fibonacci Series Numbers
  30. Sandglass Number Pattern
  31. Same Numbers on all Sides of a Square
  32. Same Numbers in Rectangle Rows and Columns
  33. Same Numbers in Square Rows and Columns
  34. Square Number Pattern
  35. Square With Diagonal
  36. Square of Left Decrement Numbers Pattern
  37. Square of Left Shift Numbers Pattern
  38. Square of Right Increment Numbers Pattern
  39. Square of Right Decrement Numbers
  40. Square of Numbers in Sine Wave
  41. Simple Number
  42. Triangle Numbers
  43. Triangle of Numbers in Reverse
  44. Triangle of Mirrored Numbers
  45. Inverted Triangle Numbers
  46. Left Shift the Square of Odd
  47. V Numbers Pattern

Java Programs on Alphabet Pattern

  1. Diamond Alphabets
  2. Downward Triangle Alphabets
  3. Downward Triangle of Mirrored Alphabets
  4. K Shape Alphabets Pattern
  5. Left Arrow Alphabets Pattern
  6. Pyramid Alphabets Pattern
  7. Right Arrow Alphabets Pattern
  8. Right Pascals Triangle Alphabets
  9. Repeated Character Pattern
  10. Right-Triangle Alphabets Pattern
  11. Right-Triangle of Alphabets in Reverse
  12. Right-Triangle Characters Pattern
  13. Right-Triangle of Consecutive Alphabets
  14. Right-Triangle of Consecutive Row Alphabets
  15. Right Triangle of Incremental Alphabets
  16. Right Triangle of Mirrored Alphabets
  17. Inverted Right Triangle Alphabets
  18. Mirrored Right Triangle Alphabets
  19. Sandglass Alphabets
  20. Square of Right Increment Alphabets
  21. Triangle Alphabets Pattern
  22. Triangle of Alphabets in Reverse
  23. Triangle of Mirrored Alphabets
  24. Java Programming examples to Print Triangle of Same Alphabets
  25. Java Programs to Print Inverted Triangle Alphabets

Comments are closed.