Please answer it on gist Java_01-1 if you have no github account, please create one right now.
Please do google research, look into at least 3 results. And answer the question base your understanding at gist Java_01-2
Hello World
program //HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Run java file
java HelloWorld.java
Build java file
javac HelloWorld.java
it will create a HelloWorld.java
Run builded java class file
java HelloWorld
use jar simple
jar cf HelloWorld.jar HelloWorld.class
java -cp HelloWorld.jar HelloWorld
// run jar file with out manifest
use jar with Manifest file Place the MANIFEST.MF file in the META-INF directory within your project structure.
Most build tools (Maven,Gradle) automatically generate the manifest file with correct information. Configure your build script accordingly.
//MANIFEST.MF
Manifest-Version: 1.0
Main-Class: HelloWorld
Make sure run Javac to build the java file before run jar
command below
jar cfm HelloWorld.jar MANIFEST.MF *.class
java -jar HelloWorld.jar
sample2
, also defined as package. //Hello.java
package sample2;
public class Hello {
public void SayHello() {
System.out.println("Hello: Hello World!");
}
}
//main
package sample2;
import sample2.Hello;
public class Main {
public static void main(String[] args) {
System.out.println("Main: Hello World!");
//call hello in another java file
Hello hello=new Hello();
hello.SayHello();
}
}
// ./META-INF/MANIFEST.MF
Manifest-Version: 1.0
Main-Class: sample2.Main
Run Java file
java Main.java
Build all java files, go to the parent folder
javac Sample2/*.java
java -cp . sample2.Main
build with jar file
jar cfm sample2/HelloWorld.jar sample2/META-INF/MANIFEST.MF sample2/*.class
run the jar file
java -jar sample2/HelloWorld.jar
What’s the different of BlueJ from others Java IDEs? Put you answer as comments of gist Java_01-7
Try some AI tool to see how it could help you learn programming
sus-column-r
for Grok2)
Code of this page https://github.com/stoneskin/learnJava/tree/main/00_HelloWorld