Chapter 1 II Introduction to Java Theory
Chapter 1 II Introduction to Java Theory
Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank
and Mike Sheridan, in the year of 1991, in the Broomfield, Colorado (USA) by Sun
Microsystem.
In 1991, at Sun Microsystems, Green team led by James Gosling started working on a
new technology for consumer electronic devices. Over the next 18 months, in 1992 the
team created a new programming language which they called “Oak”, by the James
Gosling after an Oak tree outside his window at Sun. Oak was renamed to Java and
on 23rd of May 1995, Sun microsystems made its first public release.
Compile Interpreted by JVM
CHARACTERISTICS OF JAVA :-
Page | 1
UMESH COMPUTER KENDRA (PH: 9897188951}
1. Simple: - Java is a simple easy to learn language. The removal of many
unreliable features of C and C++, and simplified its understanding and
implementation.
2. Object Oriented: - Java is a pure object-oriented programming language
because it treats everything as an object. Even the most elementary program
has a class.
3. Platform Independent: - The concept of “Write Once, run anywhere”, is
one of the most powerful features of java, which make it a very powerful
language. Java application can run on any platform that has the JVM installed
on it.
4. Secure: - Java is secure because it allows Applets to confine to the java
runtime environment only. Applets cannot be accessing any other part of the
computer when downloaded on the web browser.
Page | 2
UMESH COMPUTER KENDRA (PH: 9897188951}
5. Robust: - Java is a robust and reliable programming language. Its powerful
compiler checks for early errors during compilation and interpreter checks for
any runtime errors.
6. Multithreaded: - Multithreaded is a ability of an application to perform
multiple task simultaneously.
7. Java programs are both compiled and interpreted.
8. It can access data form from a local system as well as from the net.
9. Java programming is written within a class. The variables and functions
are declared and defined in the class.
10. Java is a case sensitive, the upper case and lower-case letters are
distinguished by the language.
Page | 3
UMESH COMPUTER KENDRA (PH: 9897188951}
Compiler Interpreter
It converts the whole source program It converts the source program into the object
into the object program at once. program, one line at a time.
It displays the errors for the whole It displays the error one line at a time and only
program together, after the after fixing that error the control goes to the next
compilation. line.
JAVA APPLETS AND APPLICATIONS: - Java can be used two type of programs:
Applets and Applications.
Applets: - An applet is a program written in java programming language.
Applets are used for internet programming. Applets can be used in webpages.
Applets cannot run directly on a user’s machine but need a web browser.
Page | 4
UMESH COMPUTER KENDRA (PH: 9897188951}
Applications: - An application is a standalone program (like any other
application created in C/C++) which run independently on a computer. Java
standalone applications can either be console-based or a Graphic-based.
1. Console-Based java application use a text-only interface. Ex: cmd.exe
2. Graphic-Based java application uses a graphical interface. Ex: Window
calculator.
JAVA VERTUAL MACHINE: - Java Interpreter converts byte code into machine
code. The byte code is the general binary form of the java source code. This
Page | 5
UMESH COMPUTER KENDRA (PH: 9897188951}
binary form needs to be modulated according to the machine on which it is
to be executed. Java interpreter plays an important role acting as a machine
to produce object code compatible to the specific machine. Java interprater
is still referred as the Java Virtual Machine (JVM).
FEATURES OF BLUEJ: -
1. The compilation and execution of program is comparatively easier.
2. It provides window approach.
3. It provides a sample program in window after making a class.
4. It highlights the error in the lower pane of window.
5. It can be used with the latest version of java.
6. It displays a graphical representation of the class in the program.
Page | 8
UMESH COMPUTER KENDRA (PH: 9897188951}
OUTPUT STATEMENT IN JAVA PROGRAMMING: - The statement which is
used to get the output of the program or to display messages on the screen,
is given as:
System.out.println();
e.g. System.out.println(“Welcome to Java Programming”);
It displays the message in same line and place the cursor in the next line, i.e.
next successive output take place in next line.
e.g. System.out.print(“Welcome to Java Programming”);
It displays the message in same line and place the cursor in the same line, i.e.
next successive output take place in the same line.
Page | 9
UMESH COMPUTER KENDRA (PH: 9897188951}
COMMENTS: - Comments are the remark from the programmer to describe
the operation of the program to anyone who is reading its source code.
Comments line are ignored by the compiler.
Java supports three type of comments:
1. Single line comments: A single line comments begins with a double
forward slash (//) and ends with the end of the line.
2. Multiline comments: This type of comment begins with forward slach
followed by an asterisk sign (/*) and ends with an asterisk sign followed by
the forward slash (*/). It is used for more than one-line comments.
3. Documentation Comments: This type of comment begins with forward
slash followed by double asterisk sign (/**) and end with the asterisk
followed by a forward slash (*/).
Page | 10
UMESH COMPUTER KENDRA (PH: 9897188951}