Hello programmers, Learning Java but don't know where to start.
Start from there where everyone starts , yes you are at right place - The Hello world program in Java.
No matter whether you are beginner or professional lets just learn it how we can print hello world in java.
Before we start this article you should know few things .
1. Java is a complete Object oriented Programming language.
2. Your code must be written inside a class.
3. Java is a case sensitive language.
So lets write hello world program in Java
So yeah that's it , this is your hello world program in Java.
I know what you are thinking this code is looking so big comparing to C++ and Python, but believe this is just a format in which everytime you will be writing your code . If you have read 3 points that I mentioned on second point says "Your code must be written inside a class." that's what we have done.
Our class is HindiCodingCommunity inside the class we have created our main function .We can pass string arguments to main function at the run time but right now we do not need it.
Everytime you write a Java code you have to make a class as in the above code I have made.
You have created a class but don't you think how your code is going to execute. For that you need a main method and remember that your main method must be
1. public - So that it can be accessed publically.
2. static - If it is not static then in that case you will have to create an object and then call this main method. So make sure it is static.
3. void - main method returns nothing in java.
4. String args[] - You want to pass some arguments during run time then you can pass them using String args[].
Now we have written four things here.
1. System - It is a standard class in java
2. out - It is an Object of System class.
3. println - It is a method of out in which we pass some string and that string is printed on the console and next time we do some print operation that will happen on the next line. Instead of println we can also use print but in case of print everything will be printed on same line.
4."Hellllllloooo Wooooooorld" - This is a string .
In this way we can print hello world in Java language.
Hindi coding community provides you the best articles for you to learn Java . If you want to write for us please contact us at hindicodingcommunity@gmail.com