|
CS-WIKI101
|
| Operating System | Architecture |
|---|---|
| macOS Sonoma 14.0 | M1 chip |
| Ubuntu server 22.04 | M1 chip |
NOTE As a multi-file source-code program you can use Gradle to compile and run complex programs that consist of multiple source-code files. This method is quite advanced and is not recommended for beginners.
Create a file named HelloWorld.java and copy the following code into it:
Compile the program using the javac command:
javac command creates a file named HelloWorld.class that contains bytecode version of the program.
Run the program using the java command:
The program prints the following output:

Project structure:
you can create the project structure manually or use the following command to
Main.java and Greet.java are located in the src/com/myproject directory.
Main.java:
Greet.java:
Compile the program using the javac command:
Run the program using the java command:
The program prints the following output:

NOTE Gradle is quite advanced and is not recommended for beginners. You can use JAVAC: Java Compiler to compile and run simple programs.
For more information, see Gradle User Manual
Need assistance? Check out my discussion board or review the GitHub status page.
© 2023 AppleBoiy • Code of Conduct • [MIT License](LICENSE)