Java Tutorial

Java Syntax

Java Syntax

Every Java program has rules for how statements are written and executed.

  • Follow Java syntax rules for statements and blocks
  • Use comments to document code
  • Run examples in the Try it editor

Example

String name = "Sturdee";
int year = 2026;
System.out.println(name + " " + year);
Try it Yourself
Run this JAVA example in your local environment or course sandbox.