HelloWorld.javaFrom WikiJavabuy this book
The beginning of every programmer. Hello world is by (C) tradition the first program a programmer writes and the first program you execute when you install a compiler. It gives an inside of the basic structures of the language and if you see on your screen the "hello world!!!" string it means that the compiler is properly installed and running.
the articleHello world is the simplest program you can write that generates an output that you can see. Note that even the "Hello world" in Java requires the definition of a class. You can go as simple as putting a single method in the class, and that will be: public static void main(String[] args) this is the default starting point of every Java program. A main method is always required and must always be written in this exact way. inside the method you can finally insert your Java commands which, in this case, are limited to the System.out.println("Hello World!!!");
Which prompts in the default output the string passed as parameter. As you can see the comments are written between the /* and */ strings. There are other ways to insert comments in Java the particular ones shown in this example will be interpreted to form the javadoc. HelloWorld.java
/** * Hello World * * @author Giulio */ public class HelloWorld { /** * * Prints on the default output a greeting to the world. * * @param args */ public static void main(String[] args) { System.out.println("Hello World!!!"); } } |
