0% found this document useful (0 votes)
3 views

JAVA UNIT 1.1

Java is a general-purpose, object-oriented programming language developed by Sun Microsystems in 1991, designed to be simple, portable, and reliable. It features a two-stage system combining compilation and interpretation, making it platform-independent and suitable for internet applications. The Java environment comprises the Java Development Kit (JDK) and the Java Runtime Environment (JRE), which includes tools and libraries necessary for developing and executing Java programs.

Uploaded by

samarthzaware990
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JAVA UNIT 1.1

Java is a general-purpose, object-oriented programming language developed by Sun Microsystems in 1991, designed to be simple, portable, and reliable. It features a two-stage system combining compilation and interpretation, making it platform-independent and suitable for internet applications. The Java environment comprises the Java Development Kit (JDK) and the Java Runtime Environment (JRE), which includes tools and libraries necessary for developing and executing Java programs.

Uploaded by

samarthzaware990
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

UNIT 1

1.1 Java Evolution:-


Java History, Java Features, Java Environment.
Java History
Java is a general-purpose, object-oriented programming language developed by
Sun Microsystems of USA in 1991.
Originally called Oak by James Gosling, one of the inventors of the language,
Java was designed for the development of software for consumer electronic devices
like TVs, VCRs, toasters and such other electronic machines.
The goal had a strong impact on the development team to make the language
simple, portable and highly reliable.
The Java team which included Patrick Naughton discovered that the existing
languages like C and C++ had limitations in terms of both reliability and portability.
However, they modeled their new language Java on C and C++ but removed a
number of features of C and C++ that were considered as sources of problems and
thus made Java a really simple, reliable, portable, and powerful language.
Table 2.1 lists some important milestones in the development of Java.
Table 2.1 Java Milestones
The most striking feature of the language is that it is a platform-neutral
language.
Java is the first programming language that is not tied to any particular hardware
or operating system.
Programs developed in java can be executed anywhere on any system.
We can call java as a revolutionary technology because it has brought in a
fundamental shift in how we develop and use programs.
Nothing like this has happened to the software industry before.
Java Features
The inventors of Java wanted to design a language which could offer solutions
to some of the problems encountered in modern programming.
They wanted the language to be not only reliable, portable and distributed but
also simple, compact and interactive.
Sun Microsystems officially des- cribes Java with the following attributes:

Table 1.2 Java Features


Although the above appears to be a list of buzzwords, they aptly describe the full
potential of the language.
These features have made Java the first application language of the World Wide Web.
Java will also become the premier language for general-purpose standalone
applications.

Compiled and Interpreted


 Usually a computer language is either compiled or interpreted. Java combines both
these approaches thus making Java a two-stage system.
 First, Java compiler translates source code into what is known as bytecode
instructions.
 Bytecodes are not machine instructions and therefore, in the second stage, Java
interpreter generates machine code that can be directly executed by the machine that
is running the Java program.
 We can thus say that Java is both a compiled and an interpreted language.
Platform-Independent and Portable
 The most significant contribution of Java over other languages is its portability. Java
programs can be easily moved from one computer system to another, anywhere and
anytime.
 Changes and upgrades in operating systems, processors and system resources will
not force any changes in Java programs. This is the reason why Java has become a
popular language for programming on Internet which interconnects different kinds
of systems worldwide.
 We can download a Java applet from a remote computer onto our local system via
Internet and execute it locally. This makes the Internet an extension of the user's
basic system providing practically unlimited number of accessible applets and
applications.
 Java ensures portability in two ways. First, Java compiler generates byte code
instructions that can be implemented on any machine. Secondly, the size of the
primitive data types are machine- independent.
Object-Oriented

 Java is a true object-oriented language. Almost everything in Java is an object. All


program code and data reside within objects and classes.
 Java comes with an extensive set of classes, arranged in packages, that we can use in
our programs by inheritance. The object model in Java is simple and easy to extend.
Robust and Secure
 Java is a robust language.
 It provides many safeguards to ensure reliable code.
 It has strict compile time and run time checking for data types.
 It is designed as a garbage-collected language relieving the programmers
virtually all memory management problems.
 Java also incorporates the concept of exception handling which captures serious
errors and eliminates any risk of crashing the system.
 Security becomes an important issue for a language that is used for
programming on Internet. Threat of viruses and abuse of resources are
everywhere.
 Java systems not only verify all memory access but also ensure that no viruses
are communicated with an applet.
 The absence of pointers in Java ensures that programs cannot gain access to
memory locations without proper authorization.
Distributed
 Java is designed as a distributed language for creating applications on networks. It has
the ability to share both data and programs.
 Java applications can open and access remote objects on Internet as easily as they can
do in a local system.
 This enables multiple programmers at multiple remote locations to collaborate and
work together on a single project.
Simple, Small and Familiar
 Java is a small and simple language.
 Many features of C and C++ that are either redundant or sources of unreliable
code are not part of Java.
 For example, Java does not use pointers, preprocessor header files, goto
statement and many others. It also eliminates operator overloading and multiple
inheritance.
 Familiarity is another striking feature of Java. To make the language look
familiar to the existing programmers, it was modeled on C and C++ languages.
 Java uses many constructs of C and C++ and therefore, Java code "looks like a
C++" code. In fact, Java is a simplified version of C++.
Multithreaded and Interactive
 Multithreaded means handling multiple tasks simultaneously. Java supports
multithreaded programs.
 This means that we need not wait for the application to finish one task before
beginning another.
 For example, we can listen to an audio clip while scrolling a page and at the same
time download an applet from a distant computer.
 This feature greatly improves the interactive performance of graphical
applications.
 The Java runtime comes with tools that support multiprocess synchronization and
construct smoothly running interactive systems.
High Performance
 Java performance is impressive for an interpreted language, mainly due to the use
of intermediate byte code.
 According to Sun, Java speed is comparable to the native C/C++, Java
architecture is also designed to reduce overheads during runtime.
 Further, the incorporation of multireading enhances the overall execution speed of
Java programs.
Dynamic and Extensible
 Java is a dynamic language. Java is capable of dynamically linking in new class
libraries, methods, and objects.
 Java can also determine the type of class through a query, making it possible to
either dynamically link or abort the program, depending on the response.
 Java programs support functions written in other languages such as C and C++.
 These functions are known as native methods.
 This facility enables the programmers to use the efficient functions available in
these languages. Native methods are linked dynamically at runtime.
Ease of Development
 Java 2 Standard Edition (J2SE) 5.0 supports features, such as Generics. Enhanced
for Loop.
 Autoboxing or unboxing, Typesafe Enums, Varargs, Static import and Annotation.
 These features reduce the work of the programmer by shifting the responsibility of
creating the reusable code to the compiler.
 The resulting source code is free from bugs because the errors made by the
compiler are less when compared to those made by programmers.
 Thus, each of the linguistic features is designed to develop Java programs in an
easier way.
Scalability and Performance
 J2SE 5.0 assures a significant increase in scalability and performance by
improving the startup time and reducing the amount of memory used in Java 2
runtime environment.
 For example, the introduction of the class, data sharing in the Hotspot Java Virtual
Machine (JVM) improves the startup time by loading the core classes from the jar
files into a shared archive.
 Memory utilization is reduced by sharing data in the shared archive among
multiple JVM processes.
 In the earlier versions, the data was replicated in each JVM instance.
Monitoring and Manageability
 Java supports a number of APIs, such as JVM Monitoring and Management API,
Sun Management Platform Extension, Logging, Monitoring and Management
Interface, and Java Management Extension (JMX) to monitor and manage Java
applications.
 For example, Java provides JVM Monitoring and Management API to track the
information at the application level and JVM level when deploying a large
application.
 Java provides tools, such as jconsole, jps, jstat, and jstatd to make use of monitoring
and management facilities.
 For example, GUI-based tool called jconsole is used to monitor the JVM.
Java Environment

Java environment includes a large number of development tools and hundreds of


classes and methods.
The development tools are part of the system known as Java Development Kit (JDK)
and the classes and methods are part of the Java Standard Library (JSL), also known as
the Application Programming Interface (API).
Java Development Kit
 The Java Development Kit comes with a collection of tools that are used for
developing and running Java programs.
 They include: 1. appletviewer (for viewing Java applets), 2. javac (Java compiler), 3.
java (Java interpreter), 4. javap (Java disassembler), 5. javah (for C header files), 6.
javadoc (for creating HTML documents), 7. jdb (Java debugger)
 Table 1.3 lists these tools and their descriptions.

Table 1.3 Java Development Kit


The way these tools are applied to build and run application programs is
illustrated in Fig. 1.3. To create a Java program, we need to create a source code
file using a text editor.
The source code is then compiled using the Java compiler javac and executed
using the Java interpreter java.
The Java debugger jdb is used to find errors, if any, in the source code.
A compiled Java program can be converted into a source code with the help of
Java disassembler javap.
We learn more about these tools as we work through the book.
Application Programming Interface
 The Java Standard Library (or API) includes hundreds of classes and methods grouped into
several functional packages (see Appendix B). Most commonly used packages are:
1. Language Support Package: A collection of classes and methods required for
imple- menting basic features of Java.
2. Utilities Package: A collection of classes to provide utility functions such as date
and time functions.
3. Input/Output Package: A collection of classes required for input/output manipula-
tion.
4. Networking Package: A collection of class- es for communicating with other
computers via Internet.
5. AWT Package: The Abstract Window Tool Kit package contains classes that
imple- ments platform-independent graphical user interface.
6. Applet Package: This includes a set of classes that allows us to create Java ap-
plets.
Fig 1.1 Process Of Building And Running Java Application Programs

The use of these library classes will become evident when we start developing Java programs
Java Runtime Environment
The Java Runtime Environment (JRE) facilitates the execution of programs
developed in Java. It primarily comprises the following:
1. Java Virtual Machine (JVM): It is a program that interprets the intermediate
Java byte code and generates the desired output. It is because of byte code and JVM
concepts that programs written in Java are highly portable.
2. Runtime class libraries: These are a set of core class libraries that are required
for the execution of Java programs.
3. User interface toolkits: AWT and Swing are examples of toolkits that support
varied input methods for the users to interact with the application program.
4. Deployment technologies: JRE comprises the following key deployment
technologies:
(a) Java plug-in: Enables the execution of a Java applet on the browser.
(b) Java Web Start: Enables remote-deployment of an application. With Web
Start, users can launch an application directly from the Web browser without going
through the installation procedure.
Thank You

You might also like