Hello World in Java
/*This is the first java codeThis print Hello World on Screen*///class "Main" remove with your java file name
This is the comment in java, like other programming languages. The content of the comment are ignored by compiler. Comments are useful for programmers.
// it is single line comment, it is also ignored by compiler.
class Main
Class is keyword in java,and it define new class, and Main is name of class,
and it is the Identifier. We define Class in next topics.
public static void main(String[] argu)
The public keyword is an access specifier, which allows programmers to access
main method anywhere from the code. we read more about Access Specifiers in
next lectures. main() is function in java, (like c/c++), all Java applications
begin execution by calling main() method. static means main() method must call
without any object.
System.out.print("Hello World");
System is a predefined class that provides access to the system, and out is the output stream that
is connected to the console. And print() is used to display string. "Hello world" is our string and we
change to this text.
NOTE: System.out.print() is used to display on terminal, we read other ways in next topics.
Print new Line in Java:
Method 01:
System.out.println("Hello World");
println() is used to print new line in java.
0 Response to "Hello world in Java"
Post a Comment