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.

Want to learn Java by writing code yourself? Enroll in our Interactive Java Course for FREE.

  1. Java Program to Join Two Lists
  2. Java Program to Convert a List to Array and Vice Versa
  3. Java Program to Convert Map (HashMap) to List
  4. Java Program to Convert Array to Set (HashSet) and Vice-Versa
  5. Java Program to Sort a Map By Values
  6. Java Program to Sort ArrayList of Custom Objects By Property
  7. Java Program to Implement LinkedList
  8. Java Program to Implement stack data structure
  9. Java Program to Implement the queue data structure
  10. Java Program to Get the middle element of LinkedList in a single iteration
  11. Java Program to Convert the LinkedList into an Array and vice versa
  12. Java Program to Convert the ArrayList into a string and vice versa
  13. Java Program to Iterate over an ArrayList
  14. Java Program to Iterate over a HashMap
  15. Java Program to Iterate over a Set
  16. Java Program to Merge two lists
  17. Java Program to Update value of HashMap using key
  18. Java Program to Remove duplicate elements from ArrayList
  19. Java Program to Get key from HashMap using the value
  20. Java Program to Detect loop in a LinkedList
  21. Java Program to Calculate union of two sets
  22. Java Program to Calculate the intersection of two sets
  23. Java Program to Calculate the difference between two sets
  24. Java Program to Check if a set is the subset of another set
  25. Java Program to Sort map by keys
  26. Java Program to Pass ArrayList as the function argument
  27. Java Program to Iterate over ArrayList using Lambda Expression
  28. Java Program to Implement Binary Tree Data Structure
  29. Java Program to Perform the preorder tree traversal
  30. Java Program to Perform the postorder tree traversal
  31. Java Program to Perform the inorder tree traversal
  32. Java Program to Count number of leaf nodes in a tree
  33. Java Program to Implement the graph data structure
  34. Java Program to Remove elements from the LinkedList.
  35. Java Program to Add elements to a LinkedList
  36. Java Program to Access elements from a LinkedList.