1.1 History
Java is a
programming language created by James Gosling from Sun Micro-systems in 1991.
The first publicly available version of Java 1.0 was released in 1995.
Java programming language the Java platform evolved. The Java platform allows that the program
code is written in other languages than the Java programming language and still
runs on the Java virtual machine.
1.2 java Virtual Machine
The Java virtual machine (JVM) is a software implementation of a computer that executes programs.
The Java virtual machine is written specifically for a specific
operating system, e.g. for Linux a special implementation is required as
well as for Windows.
Java programs are compiled by the Java compiler into so-called bytecode.
The Java virtual machine interprets this bytecode and executes the Java
program.
1.3 Java Runtime Environment And Java Developement kit
The Java runtime environment (JRE) consists of the JVM and the Java
class libraries and contains the necessary functionality to start Java
programs.
The JDK contains in addition the development tools necessary to create
Java programs. The JDK consists therefore of a Java compiler, the Java
virtual machine, and the Java class libraries.
1.4 Characteristics Of Java
1 Java is Simple
No language is simple, but Java is a bit easier than the popular
object-oriented programming language C++, which was the dominant
software-development language before Java.
Java is partially modeled on C++, but greatly simplified and improved. For instance, pointers and multiple inheritance often make programming complicated. Java replaces the multiple inheritance in C++ with a simple language construct called an interface, and eliminates pointers.
Java is partially modeled on C++, but greatly simplified and improved. For instance, pointers and multiple inheritance often make programming complicated. Java replaces the multiple inheritance in C++ with a simple language construct called an interface, and eliminates pointers.
2 Java Is Object-Oriented
Java is inherently object-oriented. Although many object oriented
languages began strictly as procedural languages, Java was designed from
the start to be object-oriented. Object-oriented programming (OOP) is a
popular programming approach that is replacing traditional procedural
programming techniques.
3 Java Is Distributed
Distributed computing involves several computers working together on a
network. Java is designed to make distributed computing easy. Since
networking capability is inherently integrated into Java, writing
network programs is like sending and receiving data to and from a file.
4 Java Is Interpreted
You need an interpreter to run Java programs. The programs are compiled
into the Java Virtual Machine code called bytecode. The bytecode is
machine-independent and can run on any machine that has a Java
interpreter, which is part of the Java Virtual Machine (JVM).
5 Java Is Robust
Robust means reliable. No programming language can ensure complete
reliability. Java puts a lot of emphasis on early checking for possible
errors, because Java compilers can detect many problems that would first
show up at execution time in other languages. Java has eliminated
certain types of error-prone programming constructs found in other
languages. It does not support pointers, for example, thereby
eliminating the possibility of overwriting memory and corrupting data.
6 Java Is Secure
As an Internet programming language, Java is used in a networked and
distributed environment. If you download a Java applet (a special kind
of program) and run it on your computer, it will not damage your system
because Java implements several security mechanisms to protect your
system against harm caused by stray programs. The security is based on
the premise that nothing should be trusted.
7 Java Is Architecture-Neutral
This feature enables Java to be architecture-neutral, or to use an
alternative term, platform-independent. With a Java Virtual Machine
(JVM), you can write one program that will run on any platform.
8 Java is Portable
Because Java is architecture neutral, Java programs are portable. They can be run on any platform without being recompiled.
9 Java's Performance
Java uses native code usage, and lightweight process called threads. In
the beginning interpretation of bytecode resulted the performance slow
but the advance version of JVM uses the adaptive and just in time
compilation technique that improves the performance.
10 Java Is Multithreaded
Multithreading is a program’s capability to perform several tasks
simultaneously. For example, downloading a video file while playing the
video would be considered multithreading.
11 Java Is Dynamic
Java programs carry with them substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run time.1.3 Development Process With Java
The programmer writes Java source code in a text editor which supports plain text. Normally the programmer uses an Integrated Development Environment (IDE) for programming. An IDE supports the programmer in the task of writing code, e.g. it provides auto-formating of the source code, highlighting of the important keywords, etc. At some point the programmer (or the IDE) calls the Java compiler (javac). The Java compiler creates the bytecode instructions. . These instructions are stored in .class files and can be executed by the Java Virtual MachineClasspath
The classpath defines where the Java compiler and Java runtime look for .class files to load. This instructions can be used in the Java program.For example if you want to use an external Java library you have to add this library to your classpath to use it in your program.
Your first Java Program.
Write Source Code
The following java program which is developed under the Microsoft Windows.
public class Hello
{
public static void main(String args[])
{
System.out.println("Hello");
}
}
Now save this program into bin directory of your java installation with .java extension.
eg.
C:\Program Files\Java\jdk1.6.0_23\bin\Hello.java
Now for compilation you open cmd and go to your bin directory and type command as like following.
C:\Program Files\Java\jdk1.6.0_23\bin\javac Hello.java
after executing above command the Hello.class file is created which is bytes code file.
Now Executing your Hello file
C:\Program Files\Java\jdk1.6.0_23\bin\java Hello