Java Tutorial

This tutorial will teach you all about Java programming from very basic for beginner to advance.

What is Java ?

Java is one of the world's most important, widely used computer programming language.

Unlike some other computer programming languages whose influence (shape) has waned (declined) with the passage of time, Java's has grown stronger.

Today, Java is still the first and best choice in developing web-based applications.

Java is a powerful object-oriented programming language.

Java is very similar to C++ but it is specially used for web page designing. The Java programming language is a general purpose language, like C and C++, any kind of problem can be solved in this language.

The byte code interpreter program is used to run the Java program. This program is also called the Java Virtual Machine (JVM). The bytecode interpreter is not dependent on any specific computer. It can be used on any computer.

Why Java?

A key reason for Java's success is its agility. Since its original 1.0 release, Java has continually adapted to changes in the programming environment and to changes in the way that programmers program. Most importantly, it has not just followed the trends, it has helped create them. Java's ability to accommodate the fast rate of change in the computing world is a crucial part of why it has been and continues to be so successful.

History of Java

Java is developed in 1991 by sun microsystems.

To fully understand Java, one must understand the reason behind its creation, the forces that shaped it, and the legacy that it inherits. Like successful computer languages that came before, Java is a blend of the best elements of its deep heritage combined with innovative concepts, required by its unique mission.

Although Java has become inseparably linked with online environment of the Internet.

Computer language and developments occurs for two fundamental reasons :

How Java Changed the Internet?

The Internet helped launcher Java to the head of programming, and Java, in turn, had a profound effect on the Internet. In addition to simplifying web programming, Java innovated a new type of networked program called the applet that changed the way that the online world thought about content. Java also addressed some of the thorniest issues associated with the Internet: portability and security.

Java Applets

An applet is a special form of Java program that is designed to be transmitted over the Internet and automatically executed by a Java-compatible web browser.

Security

As you are probably aware, every time you download a "normal" program, you are taking a risk (danger), because(as) the code you are going to download might contain a virus. Trojan horse, or other harmful code. At the core of the problem is fact that the malicious code can cause its damage because it has gained unauthorized access to system resources.

Java achieved this protection by confining (limiting) an applet to the Java execution environment and not allowing it access to the other parts of the computer.

Portability

Portability is a major aspect of Internet because there are many dissimilar types of computers and operating systems, connected to it. If any Java program were to be run on virtually any computer connected to Internet, there needed to be some way to enable that program to execute on different system.

Java's Magic: The Bytecode

The main key, allows Java to solve, security and portability, both the problems, just described is that the output of Java compiler is not executable code, instead, it is bytecode, which is highly optimized set of instructions that is designed to be executed on the Java runtime system, called as Java Virtual Machine (JVM).

Servlets: Java on the Server Side

As useful as the applets can be, they are just one half of client/server equation. Not long after the initial release of Java, it became evident that Java would also be useful on server side. The result was the servlet. A servlet is a small program that executes on the server. Just an Applets dynamically extend the functionality of a Web browser; Servlets dynamically extend the functionality of a Web server. So, with coming of the servlet, Java spanned both sides of the client/server connection.

The Java Buzzwords

No discussion of the Java's history can complete without a look at the Java buzzwords.Security and portability are the fundamental forces that neccessitated (demanded) the invention of Java, other factors are also played an important role in molding the final form of the language. The key consideration were summed up by the Java team in the following list of buzzwords:

Following is a simple Java program :

import java.util.Scanner;

public class fresherearth
{
   public static void main(String[] input)
   {
      System.out.println("Java Tutorial at fresherearth.com");
   }
}

The sample output produced by above program, is shown in the snapshot given below:

java tutorial

Following is one more Java programming example :

import java.util.Scanner;

public class fresherearth
{
   public static void main(String[] input)
   {
      String name;
      Scanner scan = new Scanner(System.in);
      
      System.out.print("Enter Your Name: ");
      name = scan.nextLine();
      
      System.out.println("\nHey,\n" +name+ "!\nAre you ready?");
   }
}

The snapshot given below shows the sample run of above Java code, with user input Albert:

learn java

Note - Don't be confuse from the above Java program, this is just an example, you will learn all the concepts of Java programming in separate chapters later.

You will learn all about Java in this tutorial series.

Audience

This tutorial is designed and developed to help all those Java programmers, who are interested to practice a lot of programs in Java along with its description.

In this tutorial series, we have included as many program as required in each and every chapter.

Prerequisites

Before start learning Java, you must have some basic computer knowledge.

And if you have some basic knowledge in how to program in C or C++, then it becomes very easy to learn Java here.

Java Online Test


« fresherearth Home Next Tutorial »