"Programs must be written for people to read, and only incidentally for machines to execute."

Note: Below code examples are present in the Java tutorials which have been mirrored here with direct links for convenience. To browse through the examples in the downloaded tutorials, you will have to start from index.html. In it select - Trails Covering the Basics >> Learning the Java Language >> Language Basics.

Observe how the standard naming and coding conventions are followed in the examples.

  1. ArrayDemo
  2. ArithmeticDemo (Arithmetic Operators: +, -, *, /, % )
  3. ConcatDemo (String Concatenation)
  4. UnaryDemo (Unary Operators: +,-, ++, --,! )
  5. PrePostDemo (Prefix/Postfix Unary Increment Operatora)
  6. ComparisonDemo (Example for Equality and Relational Operators: ==, !=, >, >=, <, <= )
  7. Conditional1Demo
  8. Conditional2Demo (Ternary Operator (expression)?(return this if true):(return this otherwise))
  9. InstanceofDemo (Type Comparison Operator instanceof)
  10. BitDemo (Bitwise &)
  11. BlockDemo
  12. IfElseDemo
  13. SwitchDemo
  14. SwitchDemoFallThrough
  15. SwitchDemo2
  16. WhileDemo
  17. DoWhileDemo
  18. ForDemo
  19. EnhancedForDemo
  20. BreakDemo
  21. BreakWithLabelDemo
  22. ContinueDemo
  23. ContinueWithLabelDemo
  24. Bicycle
  25. MountainBike
  26. PassPrimitiveByValue
  27. Point
  28. Rectangle
  29. CreateObjectDemo
  30. DataStructure
  31. Day
  32. EnumTest
  33. Planet
  34. Animal
  35. Cat
  36. Superclass
  37. Subclass
  38. TestFormat
  39. DecimalFormatDemo
  40. BasicMathDemo
  41. ExponentialDemo
  42. TrigonometricDemo
  43. StringDemo
  44. ValueOfDemo
  45. ToStringDemo
  46. Filename
  47. FilenameDemo
  48. RegionMatchesDemo
  49. StringBuilderDemo
  50. Box
  51. BoxDemo3
  52. CopyBytes
  53. CopyCharacters
  54. CopyLines
  55. ScanXan
  56. ScanSum
  57. Root
  58. Root2
  59. Format
  60. HelloRunnable
  61. HelloThread
  62. SleepMessages
  63. SimpleThreads