- Create your own class and make it output a "Hello world" message.
You should create a class with a static method that prints the "Hello world"
message. There's already a Main.java
file with a Main
class as an example in
this repo's source folder. Feel free to go through it if you're stuck.
- Your class must be saved in a file that has the same name as your class. For
example,
SampleClass
must saved in a file namedSampleClass.java
- Your class must have a
public static void main(String[] args)
method in order to be runnable from the command line - You will compile your class with the
javac
command on the command line, e.g.javac SampleClass.java
- You will then run your class with the
java
command on the command line, e.g.java SampleClass
- The instruction to print text on the screen is
System.out.println("message here");