The Main file
Inside your src
folder make a file called Main.java
. This is the file where
we are going to write the "start" of the program.
All the Java code you've written up until now will work if you put it into this file.
void main() {
System.out.println("Hello, world!");
}
So you should now have something that looks like this.
project/
src/
Main.java
To run your program, use the java
command.
$ java src/Main.java
Hello, world!