Java - First Program
Your First Java Program
Create Hello.java:
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello, Java!");
  }
}
Compile and run:
javac Hello.java
java Hello
Project Structure (Maven)
demo/
  src/
    main/java/com/example/App.java
    test/java/com/example/AppTest.java
  pom.xml
Project Structure (Gradle)
demo/
  src/
    main/java/com/example/App.java
    test/java/com/example/AppTest.java
  build.gradle
  settings.gradle
Try it
- Print the sum of two numbers passed via args(convert withInteger.parseInt).
- Change the package to com.example, move the file into folders, and compile withjavac com/example/Hello.java.
- Create a Gradle/Maven project and run the same Hello class from the build tool.