How to create first Java Program?

How to create first Java Program?

Hi,

I am beginner and I want to write first Java program. How I can setup my machine and write first Java program?

Thanks

View Answers

April 4, 2017 at 10:08 AM

Hi,

Check this video tutorial also:

Video tutorial on creating First Java Program

Thanks


April 4, 2017 at 10:04 AM

HI,

Here are the steps to write and run first Java program:

Create program in Note pad:

Step 1: Open the notepad on windows computer. Then type or copy the following code:

class HelloWorld {
   public static void main(String[] args){
   System.out.println("My First Java program");
   }
}

Then click on save from file menu in note pad. In the file name box type HelloWorld.java and it should be in double quotes. It should like "HelloWorld.java"

After saving you can compile and run code:

Step 2: Compile program:

Open dos prompt and go to the directory where you have saved your file and then type:

C:\example>javac HelloWorld.java

This will compile HelloWorld.java and create byte code file HelloWorld.class.

You should verify HelloWorld.class by running the dir dos command.

Step 3: Run example

To run example type:

C:\example>java HelloWorld

and it should print message.

Here is full video tutorial:

You can download code and see more details at Hello world (First java program).

Check more tutorials at:

Core Java Home page

Steps to Learn Java --> New to Java

Learn Java in a day

Master Java In A Week

Thanks









Related Tutorials/Questions & Answers:
java program7
How to create first program in Java?
Advertisements
How to create first Java Program?
program3 - Java Beginners
program1 - Java Beginners
program2 - Java Beginners
ModuleNotFoundError: No module named 'programo'
ModuleNotFoundError: No module named 'programy'
write a programm using java
java programe
how to execuite java programs???
how to execuite java programs???
java programm
menu drive programm in java
menu drive programm in java
java programe - Java Beginners
ModuleNotFoundError: No module named 'program1'
top 20 basic programm of java
java programe - Java Beginners
programs in java
construction in java programm
programm
programm
Programs in java
Java Programs
Simple Java Programs
Hibernate ORM - learn to create first application
java programs
java programe executing error - Java Beginners
java programs
First Lambda Expressions in Java
how to write a programm in C for included code below
How to Run First Java Bean Program ?
java programs
how to compile programs??????????
How can java programs execute automatically when it connects to network
java programs
how to create notepad in java
How to create a class in java
How to create charts in Java?
How to Create Keyboard in JAVA
java programs
java programs
java programs
java programs
java programs
java programs
how to create interfaces in java
Java Programs
Explain types of java programs

Ads