Tuesday 15 September 2020

Getting Started with Java

 Getting Started with Java 

To start Java Programming As A Beginner, You need to install Java for your computer. If you already installed Java on your computer, You can check it using the following code.

  • Open your command prompt and run this code ➡➡ java -version

  • If You have installed Java, you will get the details of the Java version as below.

If You haven't installed Java in your pc, You can download the Java Development Kit (JDK) from here.
 (www.oracle.com

After the Successful installation of Java, You will get the version details as in the above picture.

Now, You can start coding with Java. But in here, I used the Text Editor (Notepad) to write my code in the start. As a beginner for java, you can follow these steps and use notepad to write your codes. However, you can use many other Integrated Development Environment (IDE) for writing java codes which are specially designed for Java programming like NetbeansIntelliJ IDEAEclipse, etc.

Quickstart - How To Run Your First Java Program?

So, Let' start writing our first Java Programme. As I mentioned, I am using Text Editor(Notepad) to write codes. Especially I need to mention that, Every Java Application begins with a Class Name and that Class Name must be matched with the Application's File Name.

STEP 01 - Open Text Editor(Notepad) & write the following code lines.

STEP 02 - Save the Text File as "MyClass.java". Here, I saved it in a folder called Java in my G: drive. You can save it anywhere on your computer.



STEP 03 - Open your command prompt & Navigate to the Directory where you saved your Java File.


STEP 04 - After navigating to the directory, type javac MyClass.java & Enter. This command will compile your code and if there are no errors, you will be redirected to the next line.


STEP 05
 - Finally type java MyClass & Enter.


Now, You will See our program is successfully compiled and given the output as "Hello World". Don't Worry, if you don't understand the above code, I will discuss about Java in the next posts for further. However, If you have done this & got the results, Congratulations, You have successfully written and executed your first Java Programme. Keep it Up. See you in the Next Chapter. Thank You.

No comments:
Write Comments