Learn Java_ Hello World
Learn Java_ Hello World
Hello World
Print Line
Comments
Comments are bits of text that are ignored by the // I am a single line comment!
compiler. They are used to increase the readability of a
program.
Single line comments are created by using // . /*
Multi-line comments are created by starting And I am a
with /* and ending with */ .
multi-line comment!
*/
Compiling Java
In Java, when we compile a program, each individual # Compile the class file:
class is converted into a .class file, which is known as
javac hello.java
byte code.
The JVM (Java virtual machine) is used to run the byte
code. # Execute the compiled file:
java hello
Whitespace
System.out.println("Another statement");
// Output:
// Example of a statement
// Another statement
Statements
main() Method
}
Classes
System.out.println("I am a person,
not a computer.");
Print Share