01 Java Introduction

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 5

JAVA

1. Java is a Pure object oriented programming language.


2. Java was developed by the Team called "Green Team" , In the Year 1990.
the Team header by James Gosling.
3. In the Year 1994, The language "Oak" was released.
4. But in January 1996 the language "Oak" was renamed to Java was
released.

History of Java
 Introduced in 1995 by Sun Microsystems.
 Its objective was to develop a software for embedding in
consumer electronic devices.
 Initially called ‘Oak’.
 Java being secure, portable, and platform-independent
was found to be capable of addressing large scale
problems across the Internet.

What is Java ?

 An object-oriented programming language.


 A cross platform language.
 It is used to create stand-alone applications, net based
programs and programs for consumer devices.

Example : cellular phones, palm pilots

Features:
Simple - The Java designers removed a number of
complex features that existed in C, such as pointer
manipulation, operator overloading etc.
 Object-Oriented - Everything is an object in Java.
Therefore, the focus is on the data, and the methods that
operate on the object in the application instead of
procedures.
 Platform-independent - It refers to the ability of the
program at the source level, which allows the user to
move the source code from one system to another,
compile the code, and run it cleanly on a system.
 Robust - Java checks the code at the time of
compilation, and also at the time of interpretation.
 Swing – A new set of classes and interfaces used to
create an advanced GUI with a “look and feel” design.
 Drag and drop – The capability to interactively transfer
information across different applications and from one
part of a program’s interface to another.
 Java 2D API - A set of classes for advanced 2D graphics
and imaging.
 Java Sound – A totally new set of characteristics
pertaining to Java’s audio features.
 RMI - Remote Method Invocation allows applications to
call object methods located at remote sites and
communicate with them.

The Java Virtual Machine (JVM)

It has an interpreter component that enables


communication between Java byte code and a
computer’s operating system.
 Java code can run on any platform by using JVM.
 JVM normally reads and executes Java statements one
at a time.
 JVM is responsible for platform independence.
 Recognizes only a particular binary format called a class
file.

JDK(The Java Development Kit)

 It contains the software and tools needed to compile, debug


and execute applets and applications written in the Java
language.
 It is a set of command-line tools.
 Some versions of the Java language are:
 Java 1.0
 Java 1.1
 Java 2
 Java 1.4.2
 Freely available at Sun’s official website.

Tools under JDK

 javac: Compiler used to compile Java source code.


 Syntax: javac [option] source
 Source files end with an extension of .java
 Options can include:
 -classpath
 -d
 java: Interpreter used to execute Java byte codes.
 java [option] classname [arguments]
 Options can include
 -classpath

 appletviewer: Used to view and test applets.


 Syntax: appletviewer [options] url

A Simple Program of Java

class sample
{
public static void main(String ar[])
{
System.out.println("Welcome to Java");
}
}

 The symbol /* */ indicates that the statements that follow are


comments in that program. The multi line comment begins
with /* and ends with */. A single line comment begins with a //
and ends at the end of the line.
 The keyword class declares the definition of the class. It also
helps the compiler to understand that it is a class declaration.
 The entire class definition, including all its members, is done
within the open ({ ) and closed ( }) curly braces. This marks
the beginning and end of the class definition block.
 The program execution begins from main() method.
 The public keyword is an access specifier, which controls the
visibility and scope of class members.
 The static keyword allows the main() method to be called,
without needing to create an instance of the class.
 The void keyword tells the compiler that the main() method
does not return any value when it is executed.
 The main() method is the starting point for all Java
applications.
 Args[] is an array of type String.
 The println() method displays the string that is passed to it as
an argument with the help of System.out.

You might also like