The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly. A programmer is ideally an essayist who works with traditional aesthetic and literary forms as
well as mathematical concepts, to communicate the way that an algorithm works and to convince a reader that the results will be correct. Donald E. Knuth

Introduction

What is Java ?
Java is a high level object oriented programming ( OOP ) language developed by Sun Microsystems in 1991. It is one of the most powerful and predominant language in the industry today for developing major applications. Be it banking, insurance, manufacturing, insurance or gaming, Java is everywhere. There is a significant demand for Java developers in the corporate world. The learning curve of Java is simple and basic understanding of OOP concepts makes to easier and really exciting to learn.

Java Features
Java follows an object oriented programming paradigm and any software developed using Java is a combination of entities called objects where each object constitutes data and methods which operate on that data to define the behaviour. Other important aspects of the language are :
1 ) Java is both a compiled and interpreted language. Java compiler translates the source code into bytecode instructions and Java interpreter generates the machine dependent code from the bytecode.
2 ) Java is platform independent unlike C / C++ i.e code compiled on one platform can be executed on other. This feature will be clear when we discuss Java Virtual Machine in the next module.
3 ) Java is a multithreaded language i.e we can write java programs which can do many tasks in parallel. We will illustrate this later in the tutorial.
4 ) Java ensures high performance with the use Just-in-Time compilers.
5 ) Java does automatic garbage collection which relieves the programmer form all memory management issues. Thus it is very robust and there is no pointer concept which makes it very secure as well.
6 ) Java can be used to design distributed applications which runs on internet.

About the Tutorial
This tutorial has been prepared for beginners to help them understand the basics of programming. It can also be used by professionals to refresh their skills. Learning is fun & faster when concepts are demonstrated more using examples rather than lines of text. Same guideline is followed while preparing this tutorial. It has been kept precise yet covering every aspect to help you master the language. A solid understanding of the concepts illustrated in different modules of this tutorial will make you a confident and skilled Java programmer.

Java Development Environment Setup
In order to write, compile and execute java programs on a computer system we need the following :
1 ) A Text Editor like notepad or textpad on a windows system and gedit or vim on a linux machine.
2 ) Java Development Toolkit ( JDK ) which contains all the development tools and JRE. JRE stands for Java     Runtime Environment which consists of a set of libraries which are used by Java programs at runtime.

Step 1 : Download and install JDK from the official website. Both linux and windows version are available. Also, one version of JDK comes bundled with Netbeans ( An Integrated Development Environment ). It is recommended to download this one. You can simply start writing and executing your java programs in the IDE. There is another very popular IDE called Eclipse which can be used for developing Java programs.

Step 2 : This step involves setting up the path to JDK in case you want to use standard editors like notepad, textpad, etc for writing java programs. Textpad is a nice editor to use if you are on a windows system. The tools for compilation and running can be added easily to Textpad once the path is setup.

Setting Path on Windows System
Go to My Computer, right click and select Properties. Click on Advanced system settings tab. Click on Environment Variables. Search for system variable named path and append the path to JDK to the value field. Please note that a semicolon (;) is required to separate different values for a single system variable. If the path system variable doesn't exist, the you need to create it and add the value. Usually, the path is
C:\Program Files\Java\<jdk version>\bin.
Now if you are using Textpad , go to Configure -> Preferences. Then click on Add and select Java SDK Commands and Apply the settings. Now, Textpad is ready for writing, compiling and running Java Programs.

Setting Path on Linux System
Assuming we have installed JDK under /home directory and path to JDK is /home/jdk1.6.01/bin/.
To set the path, give the command export PATH=$PATH:/home/jdk1.6.01/bin/.

Step 3 : Compiling and Executing Java Programs
If you are using IDEs like Netbeans or Eclipse, then you need to create a project and add java code files to that project then build it. If you are using Textpad, write the program, save the file with .java extension. Then use Tools -> External Tools -> Compile Java to compile and Tools -> External Tools -> Run Java Application to execute the program.
On a Linux System, suppose the java code file is saved as hello.java.
Compile : javac hello.java
Run        : java hello

Step 4 : Test your Setup
Write the following program :-

class Hello {
  public static void main( String args[] ) {
    System.out.println( "hello world" );
  }
}

Save the file as Hello.java. Please note that it is mandatory to use the filename here as Hello.java because the class shown in the the above program is named as Hello. Now, compile and run as described in step 3.
Output : hello world.
So, you have written and executed your first Java program successfully.

Next