The best way to learn Java programming is by practicing examples. The page contains examples on basic concepts of Java. You are advised to take the references from these examples and try them on your own.

All the programs on this page are tested and should work on all platforms.

  1. Java Program to Print an Integer (Entered by the User)
  2. Java Program to Add Two Integers
  3. Java Program to Multiply two Floating Point Numbers
  4. Java Program to Find ASCII Value of a character
  5. Java Program to Compute Quotient and Remainder
  6. Java Program to Swap Two Numbers
  7. Java Program to Check Whether a Number is Even or Odd
  8. Java Program to Check Whether an Alphabet is Vowel or Consonant
  9. Java Program to Find the Largest Among Three Numbers
  10. Java Program to Find all Roots of a Quadratic Equation
  11. Java Program to Check Leap Year
  12. Java Program to Check Whether a Number is Positive or Negative
  13. Java Program to Check Whether a Character is Alphabet or Not
  14. Java Program to Calculate the Sum of Natural Numbers
  15. Java Program to Find Factorial of a Number
  16. Java Program to Generate Multiplication Table
  17. Java Program to Display Fibonacci Series
  18. Java Program to Find GCD of two Numbers
  19. Java Program to Find LCM of two Numbers
  20. Java Program to Display Characters from A to Z using loop
  21. Java Program to Count Number of Digits in an Integer
  22. Java Program to Reverse a Number
  23. Java Program to Calculate the Power of a Number
  24. Java Program to Check Whether a Number is Palindrome or Not
  25. Java Program to Check Whether a Number is Prime or Not
  26. Java Program to Display Prime Numbers Between Two Intervals
  27. Java Program to Check Armstrong Number
  28. Java Program to Display Armstrong Number Between Two Intervals
  29. Java Program to Display Prime Numbers Between Intervals Using Function
  30. Java Program to Display Armstrong Numbers Between Intervals Using Function
  31. Java Program to Display Factors of a Number
  32. Java Program to Make a Simple Calculator Using switch...case
  33. Java Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers
  34. Java Program to Find the Sum of Natural Numbers using Recursion
  35. Java Program to Find Factorial of a Number Using Recursion
  36. Java Program to Find G.C.D Using Recursion
  37. Java Program to Convert Binary Number to Decimal and vice-versa
  38. Java Program to Convert Octal Number to Decimal and vice-versa
  39. Java Program to Convert Binary Number to Octal and vice-versa
  40. Java Program to Reverse a Sentence Using Recursion
  41. Java Program to calculate the power using recursion
  42. Java Program to Calculate Average Using Arrays
  43. Java Program to Find Largest Element of an Array
  44. Java Program to Calculate Standard Deviation
  45. Java Program to Add Two Matrix Using Multi-dimensional Arrays
  46. Java Program to Multiply to Matrix Using Multi-dimensional Arrays
  47. Java Program to Multiply two Matrices by Passing Matrix to a Function
  48. Java Program to Find Transpose of a Matrix
  49. Java Program to Find the Frequency of Character in a String
  50. Java Program to Count the Number of Vowels and Consonants in a Sentence
  51. Java Program to Sort Elements in Lexicographical Order (Dictionary Order)
  52. Java Program to Add Two Complex Numbers by Passing Class to a Function
  53. Java Program to Calculate Difference Between Two Time Periods
  54. Java Code To Create Pyramid and Pattern
  55. Java Program to Remove All Whitespaces from a String
  56. Java Program to Print an Array
  57. Java Program to Convert String to Date
  58. Java Program to Round a Number to n Decimal Places
  59. Java Program to Concatenate Two Arrays
  60. Java Program to Convert Character to String and Vice-Versa
  61. Java Program to Check if An Array Contains a Given Value
  62. Java Program to Check if a String is Empty or Null
  63. Java Program to Get Current Date/TIme
  64. Java Program to Convert Milliseconds to Minutes and Seconds
  65. Java Program to Add Two Dates
  66. Java Program to Join Two Lists
  67. Java Program to Convert List (ArrayList) to Array and Vice-Versa
  68. Java Program to Get Current Working Directory
  69. Java Program to Convert Map (HashMap) to List
  70. Java Program to Convert Array to Set (HashSet) and Vice-Versa
  71. Java Program to Convert Byte Array to Hexadecimal
  72. Java Program to Create String from Contents of a File
  73. Java Program to Append Text to an Existing File
  74. Java Program to Convert a Stack Trace to a String
  75. Java Program to Convert File to byte array and Vice-Versa
  76. Java Program to Convert InputStream to String
  77. Java Program to Convert OutputStream to String
  78. Java Program to Lookup enum by String value
  79. Java Program to Compare Strings
  80. Java Program to Sort a Map By Values
  81. Java Program to Sort ArrayList of Custom Objects By Property
  82. Java Program to Check if a String is Numeric
  83. Java Program to Create Directories
  84. Java Program to Rename File
  85. Java Program to List Files in a Directory
  86. Java Program to Copy File