Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions? | Software Development
 

Learn Java Quickly, Quick Java Tutorial

This is one page introduction to java, that will teach you the basics of java. In this quick Java tutorial you will download, install and then create very first java program.

Learn Java - Learn Java Quickly

                         

Java is an object oriented programming language developed by Sun Microsystems. This is freely available to public for all purposes from personal website development to big enterprises. It looks lot like C and C++ but has various extra-developed features that make it safer, easier and more useful than other object oriented languages. It is now most demanded programming skill used for developing various web-based application in e-commerce and universities.

The most important feature of Java is that it can run on different types of computer without any modification. This feature is popularly known as “Write once, run anywhere”. Again, it is used widely with Server Side web programming, where the program runs on the web server and the user can see the page using any web browser.  Also programs developed by using Java technology can be sold without paying or consulting to the Sun Microsystems.

Java Virtual Machine (JVM)

It is the principal component of Java architecture that provides the cross platform functionality and security to Java. This is a software process that converts the compiled Java byte code to machine code. Byte code is an intermediary language between Java source and the host system.

Most programming language like C and Pascal translate the source code into machine code for one specific type of machine as the machine language vary from system to system. So most complier produce code for a particular system but Java compiler produce code for a virtual machine. The translation is done in two steps. First the programs written in Java or the source code translated by Java compiler into byte code and after that the JVM converts the byte code into machine code for the computer one wants to run.

So the programs files written in Java are stored in .java files and the .java files are compiled by the Java compiler into byte code that are stored in .class file. The JVM later convert it into machine code. In fact the byte code format is same on all platforms as it runs in the same JVM and it is totally independent from the operating system and CPU architecture. JVM is a part of Java Run Time Environment that is required by every operating system requires a different JRE. JRE consists of a number of classes based on Java API and JVM, and without JRE, it is impossible to run Java. So its portability really made it possible in developing write once and run anywhere software.

In the following figure you can see the function of JVM

How to write your First Java program

Ok, now you know the basics of Java programming and have downloaded the Java Development Kit (JDK), then its time to write your first Java program.

Create a source code program in any of the text editor available like jEdit, Notepad, TextPad etc. Java program is a class with a main method in it. The main method is the starting point for every Java application. So first define the class name and lets take it as FirstProgram and write it in the text editor like below

public class FirstProgram

{

     public static void main(String[] args)

     {

          System.out.println("Hey! you are going to compile and run your first Java program");

     }

}

Here System.out.println is the incantation that one uses to get codes sent to the console. Now save the file with same name as the public class just adding the extension “.java” . Here for example FirstProgram.java. If you use a different name other than the existing class name then you will face while compiling.

After completing the above, open a doss command window and type cd to the directory in which your source file exists. Type the following code to compile the file. This should be like this:

javac FirstProgram.java

If you compile it successfully, then you can find a class file in your directory with the same name, which is the bytecode form of Java program. Now type FirstProgram.java  to run the program.

The JVM now will run the bytecode in the FirstProgram.class file. Now you will see the output on your screen as:

Hey! you are going to compile and run your first Java program

Congratulation! Now you have successfully developed your first Java program. 

                         

» View all related tutorials
Related Tags: java c design programming web com ide orm video ant form console service language io services system game vi tag

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

65 comments so far (
post your own) View All Comments Latest 10 Comments:

this is a best site to take a knowledge of java.

Posted by shishupal kumar on Monday, 01.25.10 @ 16:30pm | #94308

actuallu, i want 2 learn java from "0". so that provide/send me That more required information.

Posted by amitabha on Tuesday, 01.19.10 @ 12:34pm | #94141


whatis the Advantages of java by comparing other languages? plese help me

what purpose we are using the java?

Posted by bobby on Sunday, 01.17.10 @ 10:22am | #94090

I wnt detail explanation of source code line by line

public class FirstProgram

{

public static void main(String[] args)

{

System.out.println("Hey! you are going to compile and run your first Java program");

}

}

Posted by brijit on Sunday, 01.17.10 @ 10:16am | #94088

pls send the whole core java note

Posted by vamshi on Monday, 04.6.09 @ 08:50am | #86527

i want to learn java in a step by step mannar at an earliest time

Posted by v.sreenivasulu on Saturday, 12.6.08 @ 10:08am | #82471

i'm studying on Java SE but now i want more like J2ME to develop myself as well as my knowledge.

Posted by sambo08 on Monday, 12.1.08 @ 22:58pm | #82261

even though i installed the jvm.
Am unable to run a simple java program.

it is saying 'javac' is not recognised as an internal or external command,operable program or batch file

Posted by Nithin.I.K on Friday, 09.26.08 @ 22:14pm | #80729

I want to be a Java Programmer, and develop Website on JSP how it possible quickly.

Posted by Niranjan on Saturday, 09.13.08 @ 15:06pm | #79110

i have one doubt...

how to java install in ubuntu7.10....

Posted by muthu on Thursday, 09.11.08 @ 18:01pm | #78703

 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.