Monday, July 14, 2008

Introduction



What is Java?
1.It is Object Oriented Programming Language.
2.It is platform independent.
3.It has automatic memory management.

What is Object Oriented Programming?

It has 5 properties.
1.Abstraction
2.Encapsulation
3.Inheritance
3.Modularity
5.Polymorphism

What are the things you need to run a java program?
1.JDK software
(available in http://java.sun.com/javase/downloads/index_jdk5.jsp)
2.Set the environmental variables

How to set the environmental variables?
There are two methods.
First Method:
1.Right click on My Computer,and select properties.
2.Select the Advanced tab.
3.Click on Environmental variables button on the bottom.
4.In the System Variables, click on New button.
5.Set Variable Name : CLASSPATH
Variable Value :C:\jdk1.5\lib;
and click OK.
6.Again click New Button.
7.Set Variable Name : PATH
Variable Value :C:\jdk1.5\bin;
and click OK.

Second Method:
1.Goto command prompt and navigate to the corresponding folder.
2.set path=c:\jdk1.5\bin;
3.set classpath=c:\jdk1.5\lib;.;

How to write a java program?
1.Open Notepad
2.Write the program
3.Save it with .java extension

Important things to be noted while writing a Java Program
1.Java is case sensitive.
2.Be careful with the filenames,it should match with the class names(case).
3.There should semicolon after every statement.



General Structure of a Java program
public class CLASSNAME
{
  public void METHODNAME()
  {
    //method body
  }
  public static void main(String args[])
  {
    //body
  }
}