Java Programs for practice
This article has a list of top java programs for practice and interviews with explanation and output. This article will also serve as a reference for programs included in class 9, 10 ISCE and class 11, 12 ISC syllabus.

Number Programs

  1. Java program to find factors of a number
  2. Java program to check if a number is Kaprekar number
  3. Java program to check if a number is perfect number
  4. Java program to check if a number is Brun’s constant
  5. Java program to check if a number is Duck number
  6. Java program to check if a number is Evil number
  7. Java program to check if a number is Disarium number
  8. Java program to check if a number is Harshad(or Niven) number
  9. Java program to check if a number is Pronic number
  10. Java program to check if a number is Fascinating number
  11. Java program to find the sum of first n even numbers
  12. Java program to find sum of digits of number without loop
  13. Java program to find number of digits in a number
  14. Java program to convert number to words
  15. Java program to convert decimal to fraction
  16. Java program to convert decimal to binary
  17. Java program to convert binary to decimal
  18. Java program to convert integer to roman
  19. Java program to find frequency or occurrence of digits in a number
  20. Java program to find GCD of two numbers
  21. Java program to find factorial of a number

String Programs

  1. Java program to check if string contains another string
  2. Java program to convert string to int in 3 ways
  3. Java program to convert int to string
  4. Java program to convert string to double in 4 ways
  5. Java program to convert string to float in 3 ways
  6. Java program to convert character to string in 2 ways
  7. Java program to remove duplicate characters from a string
  8. Java program to convert char array to string
  9. Java program to compare two strings in 7 ways
  10. Java program to reverse a string using stack
  11. Java program to convert alternate characters of a string to upper case

Array Programs

  1. Java program to find length of array
  2. Java program to print an array
  3. Java program to check if array contains a value
  4. Java program to find sum of array elements
  5. Java program to check if an array is palindrome
  6. Java program to search an element in array using binary search
  7. Java program to reverse an array
  8. Java program to generate median from array elements
  9. Java program to generate array from random integers using java 8 stream
  10. Java program to generate a mirror image of 2d array

Other Programs

  1. Java program to check for a valid IMEI number
  2. Java program to convert milliseconds to minutes and seconds
  3. Java program to convert minutes to milliseconds