Our first program will print the classic “hello world” message. Here’s the full source code.
class Helloworld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
To run the program, we need to build our programs into Byte Code.
We can do this using javac Helloworld.java.
We can then execute the built java .class file directly.
javac Helloworld.java
ls
# Helloworld.java Helloworld.class
java Helloworld
# Hello world!
Top comments (0)