Java tutorial

Write Java, compile it, then read stdout or the errors.

Types, methods, classes, and collections. The editor uses javac. You get stdin, stdout, and compiler messages. Try it Yourself opens /java/try.

55 chapters. The editor is /java/try.

Topics

Start at intro, or jump to classes, collections, or projects.

What you get in this tutorial

  • javac in the browser. The right pane is stdout and compiler messages.
  • Its own editor. Lessons are under /java. The compiler is /java/try.
  • A chapter path. Change the source, compile, press Next.
  • Worked examples. Chapters end with lab-style programs: forces, moles, marks, not only int x = 3.

All chapters

Every chapter, in order.

  1. 01Java Intro
  2. 02Get Started
  3. 03Java Syntax
  4. 04Java Output
  5. 05Java Comments
  6. 06Java Variables
  7. 07User Input
  8. 08Data Types
  9. 09Java Operators
  10. 10Java Strings
  11. 11Java Math
  12. 12Java Booleans
  13. 13If Else
  14. 14Java Switch
  15. 15While Loop
  16. 16For Loop
  17. 17Break Continue
  18. 18Java Arrays
  19. 19Data Classes
  20. 20Java Enums
  21. 21Java Objects
  22. 22Java Null
  23. 23Java Methods
  24. 24Method Parameters
  25. 25Overloading
  26. 26Java Recursion
  27. 27Java OOP
  28. 28Classes Objects
  29. 29Class Methods
  30. 30Constructors
  31. 31Access Specifiers
  32. 32Encapsulation
  33. 33Inheritance
  34. 34Polymorphism
  35. 35Java Files
  36. 36Exceptions
  37. 37Java ArrayList
  38. 38Garbage Collection
  39. 39Java Examples
  40. 40Ternary Operator
  41. 41Nested Loops
  42. 422D Arrays
  43. 43Java Final
  44. 44Packages
  45. 45Interfaces
  46. 46Java Records
  47. 47Java Generics
  48. 48Java Collections
  49. 49Java Map
  50. 50Java Set
  51. 51Java Streams
  52. 52Java Lambdas
  53. 53Java Time
  54. 54Java Static
  55. 55Abstract Classes

FAQ: Java Tutorial

Common questions about this page.

What is the StudyGrid Java tutorial?

The StudyGrid Java tutorial is a full beginner-to-advanced track: syntax, types, input, loops, methods, classes, collections, generics, maps, and lambdas. Each chapter has copy-and-run examples.

Should I run java tutorial examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn java tutorial in this Java Java lesson (Java Tutorial).

Is the Java editor the same as Try Python or Try C++?

No. Try Java compiles with javac at /java/try and shows stdout plus compiler messages. Try Python stays at /try. Try C++ stays at /cpp/try. Java lessons never open those editors.

Do I need to install a JDK to learn Java?

No. Open a chapter, click Try it in Java, and compile in the browser. You can also download a .java file and compile locally with javac.

Where should I start the Java tutorial?

Start at Java Intro, then Get Started and Syntax. After the first program, continue to output, variables, and if-else. After classes, open Java Examples, then generics, map, and lambdas. Use Next at the bottom of each chapter.

Is the Java tutorial free?

Yes. The Java workshop on StudyGrid (studygrid.in) is free: dashboard, chapters, and the compile-and-run editor.