BASIC CONCEPTS IN JAVA.
How to write your first program in Java.
Java is an Object Oriented Programming language which is used by billions of devices all over the world. It is robust and easy to write.
You might have heard people talking about how difficult Java is but that shouldn’t discourage you from learning Java.
Java is a case sensitive language that. You have to be much careful on where to use a capital letter and where not to use.
I’m going to talk about all these stuffs so let’s get started.
To write your first program in Java,
1. Open Your intelliJ and select a new file
2. Check if your jdk is selected or not and select it.
3. Enter Project name and press the enter key or click on finish.
After creating a successful project, you will need to set up the environment before you can run your codes and this can be done simply.
1. 1st right click on the src folder on your left and select package. Name it your choice but it is preferred to start with com.<name>.
2. Right click on the package after it is created and select class. Give the class name you want. It can be any name of your choice
3. The last method is creating your main method and this is where all your codes go. Without a main method, your program will not run. This is done by typing
public static void main(String[] args){
//Your block of code goes here
}
You have how successfully created your environment for writing java codes, you can check if it is perfectly working by typing System.out.prtintln(“Hello World”);
After that you right click on any empty space on the background and select run to run your code. It displays Hello World in the console below.
NOTE. Don’t forget to add semi colon ; at the end of your code. If you face andy difficulties, voice is in the comment section and it will be attended to immediately.
CONGRATULATIONS!!! FOR WRITING YOUR FIRST JAVA CODE.
When you are done with this successfully, you can move on to the next topic.
0 Comments