Create your First Program in Java

To write your first program, you’ll need:

  1. The Java SE Development Kit (JDK )

    You can download from the sun website. (Make sure you download the JDK, not the JRE.) Do check installation instructions.

  2. A text editor – Notepad & Command Prompt for compile and execute.

Your first application, NEW.java, will simply display “This is a New Java Program”. To create this program, you will:

  • Create a source file using Notepad; write the code and save as ” New.java “
__________________________________________
/*
This is a New Java program.
Call this file “New.java”.
*/ class New
{

// Your program begins with a call to main().

public static void main(String args[])
{
System.out.println(“This is a New Java Program.”);
}

}
___________________________________________

  • Compile the source file into a .class file. ( You can use Command prompt)

    The Java programming language compiler (javac) takes your source file and translates its text into instructions that the Java virtual machine can understand. The instructions contained within this file are known as bytecodes.

  • Run the program

    The Java application launcher tool (java) uses the Java virtual machine to run your application.

Explanation of First Program in Java
Advertisements

What do you think? Please reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s