Hello World Program in Java
public class HelloWorld {
public static void main(String []args) {
System.out.println("Hello World!");
}
}
A Java program is organized into classes (and, packages).
The public static void main(String []args)
method of a class
can be an entry point to a Java program.
If you compile and run this program, using HelloWorld
as the main class,
you will get the following output:
Hello World!
What's Next
If you are interested in learning Java programming, then go ahead and set up a development environment.
- Next Step: Java development environment setup
C C++ C# Clojure Crystal D Dart Erlang F# Go Haskell Javascript Julia Kotlin Lua Python Rust Scala Swift Typescript