Write your First Java Program

Introduction

In this article, I am going to explain how to write your first java program and executing the program in your computer. By the end of reading you complete learning how to write a java program in your system. 

Steps involved in  writing your first program

  • Installing JDK in your computer
  • Writing your program
  • Compiling the written Program
  • Running your compiled file

 Install JDK in your computer by following instructions .

Now write your first program, Open a notepad and write the following code into it.



class MyFirstJava

{



public static void main(String[] args)
{
   System.out.println("This is my first Java Program");
}
}


Save the file with file name MyFirstJava.java .

Now Compile your Program  from command prompt into byte code  with the following command as shown below.

C:/>javac MyFirstJava.java


It create a file Named MyFirstJava.class in your folder if your code in file doesn't have any syntax errors.

Now, Run your program with the following command.

C:/>java MyFirstJava


Output will be as follows..


Your First program is Ready and working fine.

Learn writing your first program using eclipse IDE.
On the first day of xmas your true love gave you a schadenfreude

0 comments:

Post a Comment