+91 81900 98289

Java Get Started

Install a current JDK, then open a terminal in the folder that holds your source file. javac Hello.java compiles it. java Hello runs the class. Do not type the .class extension on the run command.

If javac is not recognized, the JDK bin folder is missing from PATH. On this site, Run shows the expected output of the original example. A browser cannot replace javac.

Example

String joins with +. The quote marks are part of the source, not part of the printed line.

public class Hello { public static void main(String[] args) { String city = "Chennai"; System.out.println("Ready in " + city); } }
Java 17 or newer is a solid choice for these lessons. The class name, the file name, and the name you pass to java must agree.