Writing A Simple Program In Java
Anatomy of a Java Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Key Parts Explained
- class: every piece of Java code lives inside a class.
- main method: the entry point where the JVM starts executing the program.
- System.out.println: prints text to the console.
Compiling and Running
Save the file as HelloWorld.java, compile with javac HelloWorld.java, then run with java HelloWorld — or simply click "Run" inside Eclipse.
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.
.png)