How to start programming in Java

How to start programming in Java

Hello friends,last time I have posted how to install jdk. I hope you guys found it useful.Once you install jdk on your machine and if you are new to java then you might go through a problem that how to start java programming.Here is the solution for the beginners.

1.Go to the C:/ (or the one where you stored the java folder) directory and go to the java folder which the system has    created at the time of installation.

2. Go to the jdk1.6… or  1.7… or whichever is your version,then click ‘bin’ folder,then copy the path from the address bar.

3. Now on the desktop right click ‘MyComputer’ and select ‘properties’.

4. Select ‘Advance system settings’ ->’Environment Variable’ -> from  System variable section select ‘path’ – > ‘Edit’ a small dialog box will open with variable name and variable value .

5. In the variable value field just put a ‘ ; ‘ at the end and paste the copied path and again add ‘;’  at the end.

6. Click Ok->Ok->Ok.Here you done with the setting up of the path.

Now we will see how to write the java programme.

1. Open the Text Editor.(Notepad).

2. Write a sample java programme as bellow:

 

public class Hello

{

       public static void main(String args[])

      {

               System.out.println("Hi..This is my first java programme");

      }

}

3. Save the above code with the name as Hello.java in the bin folder.

Here you have written the simple code in java.

Now we will see how to run the above code.

1. Open up the ‘command prompt’ or simply open the run and type ‘cmd’ and hit ‘ENTER’.

2. Command prompt will appears on the screen.Type ‘ cd/ ‘ and hit ‘ENTER’.

3. Type ‘cd path’ where the path= the path of you bin directory. It may be like

“cd Program Files\Java\jdk1.8.0_51\bin”.

4.Now you are in bin directory.Type javac Hello.java and hit ‘ENTER’.

5.The program will compile here.Type java Hello and hit ‘ENTER’.

6.You will get the output.i.e. Hi..This is my first java programme.

If you need any help then please fill free to ask us, you can also download our Android app from play store by searching Buzzmycode in it.

Leave a Reply

Your email address will not be published. Required fields are marked *