CHAPTER-1
*) To fully understand:- Java,one must understand the reasons behind its
creation,the forces that shaped it,and the legacy that it inherits.
Like the successful computer languages that came before,Java
is a blend of the best elements of its rich heritage combined with
the innovative concepts required by its unique mission.
>) Computer language innovation and development occurs for two
fundamental reasons:
*) To adapt to changing environments and uses
*) To implement refinements and improvements in the art of
programming.
*) Java's Lineage :- Java is related to C++,which is a direct descendant of C.
From 'C',java derives its syntax.Many of java's object-oriented
features were influenced by C++.
Each innovation in language design was driven by the need to solve a
fundamental problem that the preceding languages could not solve.
Java is no exception(A deliberate act of omission).
*) The Creation of Java :- Java was conceived(have the idea for) by
*) James Gosling
*) Patrick Naughton
*) Chris Warth
*) Ed Frank and
*) Mike Sheridan at Sun Microsystems,Inc.in 1991.
This language was initially called "Oak",but was renamed "Java" in 1995.
*) Key contributors to the design and evolution of Java :-
>) Bill Joy
>) Arthur van Hoff
>) Jonathan Payne
>) Frank Yellin
>) Tim Lindholm
*) Primary motivation :- The need for platform-independent
(that is(i.e.,) architecture-neutral) language that could to create
software to be embedded in various electronic devices.
Gosling and others began work on portable,platform-independent
language that could be used to produce code that would run on a variety of
CPUs under differing environments.
*) Secondary force :- With the emergence of World Wide Web,Java was
propelled(cause to move forward with force) to the forefront of
computer language design,because the Web,too,demanded
portable(easily or conveniently transported) programs.
*) How Java changed the Internet:-Java innovated a new
type of networked program called the applet that changed the way
the online world thought about content.It also addressed some of the
thorniest issues associated with the Internet : portability and security.
*) Java Applets :-Its a special kind of Java program that is designed to be
transmitted over the internet and automatically executed by a Java-
compatible web browser.
>) Applets are intended to be small programs and is downloaded on demand
without further interaction with the user.
>) Handles user input,or provide simple functions,
Example:- calculator ,that execute locally,rather than on the server.
>) It expanded the universe of objects,there are two very broad categories
of objects that are transmitted between the server and the client:
*) Passive
*) dynamic and
*) active programs.
Example :-When you read your e-mail,you are viewing passive data,Even
when you download a program,the program's code is still only
passive data until you execute it.
>) Applet is a dynamic,self-executing program.Such a program is an
active agent on the client computer,yet it is initiated by server.
*) Security:- Every time you download a "normal" program,The program
might contain "virus" like Trojan horse ,or other harmful code.Malicious
code can cause damage or gained unauthorized access to system
resources.
Example :- A virus code might gather private information,such as credit card
numbers, bank account balances,and passwords,by searching the
contents of your computer's local file system.
>) Java achieved this protection by confining(restricting the scope) an applet to
the Java execution environment and not allowing it access to other parts of
the computer.
*) Portability :- >) Portability is a major aspect of the Internet.
>) If a Java program were to be run on virtually any computer connected
to the internet,there needed to be some way to enable that program
to execute on different systems.
Example:- Same applet must be able to be downloaded and executed by the
wide variety of CPUs,operating systems,and browsers connected to
the Internet.
>) The same code must work on all computers.Java provides a portable
executing code and solved this problems.
*) Bytecode :- It is a highly optimized(use best) set of instructions designed
to be executed by the Java run-time system,which is called
Java Virtual Machine(JVM)
>) The output of Java compiler is not a executable code.Rather, it is bytecode.
>) Java program is executed by the JVM ,which helps in solving major
web-based programs.
>) Translating a Java program into bytecode makes it much easier to run a
program in a wide variety of environments because only the JVM needs
to be implemented for each platform.
>) JVM will differ from platform to platform,all understand the same bytecode.
>) Java program executed by the JVM helps to make it secure.and prevent it
from generating side effects outside of the system.
>) Safety is also enhanced by certain restrictions.
>) The use of bytecode enables the JVM to execute programs much faster than
you might expect.
*) Just-In-Time(JIT):- >) HotSpot provides a JIT compiler for bytecode.
>) When a JIT compiler is part of the JVM,selected portions of bytecode are
compiled into executable code in real time,on a piece-by-piece,demand
basis.
>) It is not practical to compile an entire Java program into executable code all
at once,because Java performs various run-time checks that can be done only
at run-time.
>) Not all sequences of bytecode are compiled-only those that will benefit from
compilation.The remaining code is simply interpreted.
>) JIT yields a significant performance boost.
>) The portability and safety features still remains, even if dynamic compilation
is applied to bytecode ,because JVM is still in charge of the execution
environment
*) Servlets :- A servlet is a small program that executes on the server.It
extend the functionality of a web server
>) With the advent of the servlets ,it spanned
(extend over an area or time period) both sides of the client/server
connection.
>) It is used to create dynamically generated content that is then served to the
client.
Example:- An online store might use a servlet to look up the price for an item
in a database.The price information is then used to dynamically
generate a web page that is sent to the browser.
>) Dynamically generated content is available through mechanisms such as
CGI(Common Gateway Interface).
>) Servlets are highly portable,Same servlet can be used in a variety of different
server envionments,The server should support the JVM and a servlet
container
*) The Java Buzzwords :- The fundamental forces that necessitated the
invention of Java are portability and security.The key considerations
were summed up by the Java team in the following list of buzzwords:
>) Simple
>) Secure
>) Portable
>) Object-oriented
>) Robust
>) Multithreaded
>) Architecture-neutral
>) Interpreted
>) High performance
>) DIstributed
>) Dynamic
*) Simple :- It was designed to be easy for the professional programmer to
learn and use effectively.
>) If you already understand the basic concepts of object-oriented
programming,learning Java will be even easier.
>) If you are an experienced C++ programmer moving to Java will require
very little effort
>) Java inherits the C/C++ syntax and many of the object-oriented features
of C++ ,programmers have little trouble learning Java.
*) Object-Oriented :- Java was not designed to be source-code
compatible with any other language.This allowed the Java
programmer the flexibility to design with a blank slate.
>) Outcome of this was a clean,usable,pragmatic approach to objects.
>) Java manages to maintain balance between an object and a model.
>) The Object model in Java is simple and easy to extend,while
primitive types,such as integers,are kept as high-performance
non-objects.
*) Robust :- Web world is a multiplatformed environment ,which demands
the programs that execute reliably in a variety of systems.
>) Java gave high priority to robust programs which executes on every
systems.
>) Java restricts the user in a few key areas to help to find your mistakes
early in program. development.
>) Java removes worry for the users about the most common causes of
programming errors.
>) Java is a strictly typed(identify as belonging to a certain type) language,
It checks your code at compile time also at run time.
>) Many effective bugs that often turn up in hard-to-reproduce run-time
situations are simply impossible to create in Java.
>) To better understand how Java is robust,Java eliminates the problems by
managing memory allocation and deallocation for you.Which is a tedious
and difficult task to perform in traditional programming languages.
>) Deallocation is automatic,Java provides garbage collection for unused
objects.
>) Java help in exceptional conditions by providing object-oriented exception
handling.In Java all run-time errors can-and should -be managed by your
program.
*) Multithreaded :- >) Java supports multithreaded programming,
which allows you to write programs that do many things simultaneously.
>) The Java run-time system comes with an elegant yet sophisticated
solution for multiprocess synchronization that enables you to construct
smoothly running interactive systems.
>) Java allows you to think about the specific behavior of your program,
not the multitasking subsystem.
*) Architecture-Neutral:- The main issue for the programmers
was that of code longevity and portability.
>) The main problems is that no guarantee exists that if you write a program
today,it will run tomorrow--even on the same machine.
>) Operating system and processor upgrades,changes in core system
resources can make a program malfunction.
>) JVM is an attempt to alter this situation.Their goal was "write once; run
anywhere, any time,forever." To a great extent,this goal was accomplished.
*) Interpreted and High-Performance :- Java enables the
creation of cross-platform programs by compiling into an intermediate
representation called Java bytecode.
>) Any system that implements the JVM can easily execute the bytecode.
>) Java bytecode was carefully designed so that it would be easy to translate
directly into native machine code by using JIT(Just in Time) compiler.
*) Distributed :- Java is designed for the distributed environment of
the Internet because it handles TCP/IP protocols.
>) Accessing a resource using URL is not much different from
accessing a file.
>) Java also supports Remote Method Invocation(RMI).This enables a
program to invoke methods across a network.
*) 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.
>) This make it possible to dynamically link code in a safe and expedient
manner.
>) This is crucial to the robustness of the Java environment ,in which small
fragments of bytecode may be dynamically updated on a running system.
*) The Evolution of Java
>) After the release of Java 1.0,the designers of Java had already created
Java 1.1.
>) The features added by Java 1.1 were more significant and substantial and
added many new library elements,redefined the way events are handled,
and reconfigured many features of the 1.0 library.
>) The creation of Java 2,marking the beginning of Java's "modern age."
>) It may seem odd that the first release of Java 2 used the 1.2 version
number.It originally referred to the internal version number of the Java
libraries,but then was generalized to refer to the entire release.
>) Java 2 added a new features,such as Swing and the Collections Framework,
and it enhanced the JVM and various programming tools.
>) Java 2 affected the Thread class in which the methods suspend(),resume(),
and stop() were deprecated(strong disapproval)
>) J2SE 1.3 was the first major upgrade to the original Java 2 release.
>) Although version 1.3 contained a smaller set of changes.Program written
for version 1.2 and those for version 1.3 are source-code compatible.
>) J2SE 1.4 further enhanched several important upgrades,enhancements,
and additions in Java.
Example:- It added the new keyword assert,chained exceptions and
a channel-based I/O subsystem.It also made changes to
the Collections Framework and the networking classes.
>) Version 1.4 maintained nearly 100 percent source-code compatibility
with prior versions.
>) J2SE 5 fundamentally the scope,power,and range of the language.
>) J2SE 5 major new features :-
@) Generics
@) Annotations
@) Autoboxing and auto-unboxing
@) Enumerations
@) Enhanced,for each type of loop
@) Variable-length arguments(varags)
@) Static import
@) Formatted I/O
@) Concurrency utilies
>) Each item in the list represents a significant addition to the Java language.
Some,such as generics,the enhanced for,and varargs,introduce new syntax
elements.
>) Autoboxing and auto-unboxing alter the semantics of the language and
Annotations new dimension to programming.
>) Sun elected to increase the version number to 5 as a way of emphasizing
that a major event was taking place.Thus,it was named J2SE 5,and the
developer kit was called JDK 5.
>) In order to maintain consistency,Sun decided to use 1.5 as it internal
version number.
>) 1.5 also referred to as the developer version number.5 in J2SE 5 is
called the product version number.
*) Java SE 6:- With the release of SE 6,Sun once again decided to change
the name of the Java platform.
>) First,notice that the "2" has been dropped.Thus,the platform now has the
name Java SE,and the official product name is
Java platform ,Standard Edition 6.
>) 6 in Java SE 6 is the product version number.The internal,developer version
version number is 1.6.
>) Java SE 6 builds on the base of J2SE 5,adding incremental improvements,
enhanced the API libraries,new packages and offer improvements to the
run time.
>) Java SE 6 serves to further solidify the advances made by J2SE 5.
*) A Culture of Innovation :- Java release redefined programming for the
Internet.
>) The JVM and bytecode changed the way about security and portability.
>) Applet and Servlet made the Web come alive.
>) The Java Community Process(JCP) redefined the way that new ideas are
assimilated into the language.
>) Java has never stood still for very long,Java SE 6 is the latest release in
Java's ongoing,dynamic history.
*) To fully understand:- Java,one must understand the reasons behind its
creation,the forces that shaped it,and the legacy that it inherits.
Like the successful computer languages that came before,Java
is a blend of the best elements of its rich heritage combined with
the innovative concepts required by its unique mission.
>) Computer language innovation and development occurs for two
fundamental reasons:
*) To adapt to changing environments and uses
*) To implement refinements and improvements in the art of
programming.
*) Java's Lineage :- Java is related to C++,which is a direct descendant of C.
From 'C',java derives its syntax.Many of java's object-oriented
features were influenced by C++.
Each innovation in language design was driven by the need to solve a
fundamental problem that the preceding languages could not solve.
Java is no exception(A deliberate act of omission).
*) The Creation of Java :- Java was conceived(have the idea for) by
*) James Gosling
*) Patrick Naughton
*) Chris Warth
*) Ed Frank and
*) Mike Sheridan at Sun Microsystems,Inc.in 1991.
This language was initially called "Oak",but was renamed "Java" in 1995.
*) Key contributors to the design and evolution of Java :-
>) Bill Joy
>) Arthur van Hoff
>) Jonathan Payne
>) Frank Yellin
>) Tim Lindholm
*) Primary motivation :- The need for platform-independent
(that is(i.e.,) architecture-neutral) language that could to create
software to be embedded in various electronic devices.
Gosling and others began work on portable,platform-independent
language that could be used to produce code that would run on a variety of
CPUs under differing environments.
*) Secondary force :- With the emergence of World Wide Web,Java was
propelled(cause to move forward with force) to the forefront of
computer language design,because the Web,too,demanded
portable(easily or conveniently transported) programs.
*) How Java changed the Internet:-Java innovated a new
type of networked program called the applet that changed the way
the online world thought about content.It also addressed some of the
thorniest issues associated with the Internet : portability and security.
*) Java Applets :-Its a special kind of Java program that is designed to be
transmitted over the internet and automatically executed by a Java-
compatible web browser.
>) Applets are intended to be small programs and is downloaded on demand
without further interaction with the user.
>) Handles user input,or provide simple functions,
Example:- calculator ,that execute locally,rather than on the server.
>) It expanded the universe of objects,there are two very broad categories
of objects that are transmitted between the server and the client:
*) Passive
*) dynamic and
*) active programs.
Example :-When you read your e-mail,you are viewing passive data,Even
when you download a program,the program's code is still only
passive data until you execute it.
>) Applet is a dynamic,self-executing program.Such a program is an
active agent on the client computer,yet it is initiated by server.
*) Security:- Every time you download a "normal" program,The program
might contain "virus" like Trojan horse ,or other harmful code.Malicious
code can cause damage or gained unauthorized access to system
resources.
Example :- A virus code might gather private information,such as credit card
numbers, bank account balances,and passwords,by searching the
contents of your computer's local file system.
>) Java achieved this protection by confining(restricting the scope) an applet to
the Java execution environment and not allowing it access to other parts of
the computer.
*) Portability :- >) Portability is a major aspect of the Internet.
>) If a Java program were to be run on virtually any computer connected
to the internet,there needed to be some way to enable that program
to execute on different systems.
Example:- Same applet must be able to be downloaded and executed by the
wide variety of CPUs,operating systems,and browsers connected to
the Internet.
>) The same code must work on all computers.Java provides a portable
executing code and solved this problems.
*) Bytecode :- It is a highly optimized(use best) set of instructions designed
to be executed by the Java run-time system,which is called
Java Virtual Machine(JVM)
>) The output of Java compiler is not a executable code.Rather, it is bytecode.
>) Java program is executed by the JVM ,which helps in solving major
web-based programs.
>) Translating a Java program into bytecode makes it much easier to run a
program in a wide variety of environments because only the JVM needs
to be implemented for each platform.
>) JVM will differ from platform to platform,all understand the same bytecode.
>) Java program executed by the JVM helps to make it secure.and prevent it
from generating side effects outside of the system.
>) Safety is also enhanced by certain restrictions.
>) The use of bytecode enables the JVM to execute programs much faster than
you might expect.
*) Just-In-Time(JIT):- >) HotSpot provides a JIT compiler for bytecode.
>) When a JIT compiler is part of the JVM,selected portions of bytecode are
compiled into executable code in real time,on a piece-by-piece,demand
basis.
>) It is not practical to compile an entire Java program into executable code all
at once,because Java performs various run-time checks that can be done only
at run-time.
>) Not all sequences of bytecode are compiled-only those that will benefit from
compilation.The remaining code is simply interpreted.
>) JIT yields a significant performance boost.
>) The portability and safety features still remains, even if dynamic compilation
is applied to bytecode ,because JVM is still in charge of the execution
environment
*) Servlets :- A servlet is a small program that executes on the server.It
extend the functionality of a web server
>) With the advent of the servlets ,it spanned
(extend over an area or time period) both sides of the client/server
connection.
>) It is used to create dynamically generated content that is then served to the
client.
Example:- An online store might use a servlet to look up the price for an item
in a database.The price information is then used to dynamically
generate a web page that is sent to the browser.
>) Dynamically generated content is available through mechanisms such as
CGI(Common Gateway Interface).
>) Servlets are highly portable,Same servlet can be used in a variety of different
server envionments,The server should support the JVM and a servlet
container
*) The Java Buzzwords :- The fundamental forces that necessitated the
invention of Java are portability and security.The key considerations
were summed up by the Java team in the following list of buzzwords:
>) Simple
>) Secure
>) Portable
>) Object-oriented
>) Robust
>) Multithreaded
>) Architecture-neutral
>) Interpreted
>) High performance
>) DIstributed
>) Dynamic
*) Simple :- It was designed to be easy for the professional programmer to
learn and use effectively.
>) If you already understand the basic concepts of object-oriented
programming,learning Java will be even easier.
>) If you are an experienced C++ programmer moving to Java will require
very little effort
>) Java inherits the C/C++ syntax and many of the object-oriented features
of C++ ,programmers have little trouble learning Java.
*) Object-Oriented :- Java was not designed to be source-code
compatible with any other language.This allowed the Java
programmer the flexibility to design with a blank slate.
>) Outcome of this was a clean,usable,pragmatic approach to objects.
>) Java manages to maintain balance between an object and a model.
>) The Object model in Java is simple and easy to extend,while
primitive types,such as integers,are kept as high-performance
non-objects.
*) Robust :- Web world is a multiplatformed environment ,which demands
the programs that execute reliably in a variety of systems.
>) Java gave high priority to robust programs which executes on every
systems.
>) Java restricts the user in a few key areas to help to find your mistakes
early in program. development.
>) Java removes worry for the users about the most common causes of
programming errors.
>) Java is a strictly typed(identify as belonging to a certain type) language,
It checks your code at compile time also at run time.
>) Many effective bugs that often turn up in hard-to-reproduce run-time
situations are simply impossible to create in Java.
>) To better understand how Java is robust,Java eliminates the problems by
managing memory allocation and deallocation for you.Which is a tedious
and difficult task to perform in traditional programming languages.
>) Deallocation is automatic,Java provides garbage collection for unused
objects.
>) Java help in exceptional conditions by providing object-oriented exception
handling.In Java all run-time errors can-and should -be managed by your
program.
*) Multithreaded :- >) Java supports multithreaded programming,
which allows you to write programs that do many things simultaneously.
>) The Java run-time system comes with an elegant yet sophisticated
solution for multiprocess synchronization that enables you to construct
smoothly running interactive systems.
>) Java allows you to think about the specific behavior of your program,
not the multitasking subsystem.
*) Architecture-Neutral:- The main issue for the programmers
was that of code longevity and portability.
>) The main problems is that no guarantee exists that if you write a program
today,it will run tomorrow--even on the same machine.
>) Operating system and processor upgrades,changes in core system
resources can make a program malfunction.
>) JVM is an attempt to alter this situation.Their goal was "write once; run
anywhere, any time,forever." To a great extent,this goal was accomplished.
*) Interpreted and High-Performance :- Java enables the
creation of cross-platform programs by compiling into an intermediate
representation called Java bytecode.
>) Any system that implements the JVM can easily execute the bytecode.
>) Java bytecode was carefully designed so that it would be easy to translate
directly into native machine code by using JIT(Just in Time) compiler.
*) Distributed :- Java is designed for the distributed environment of
the Internet because it handles TCP/IP protocols.
>) Accessing a resource using URL is not much different from
accessing a file.
>) Java also supports Remote Method Invocation(RMI).This enables a
program to invoke methods across a network.
*) 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.
>) This make it possible to dynamically link code in a safe and expedient
manner.
>) This is crucial to the robustness of the Java environment ,in which small
fragments of bytecode may be dynamically updated on a running system.
*) The Evolution of Java
>) After the release of Java 1.0,the designers of Java had already created
Java 1.1.
>) The features added by Java 1.1 were more significant and substantial and
added many new library elements,redefined the way events are handled,
and reconfigured many features of the 1.0 library.
>) The creation of Java 2,marking the beginning of Java's "modern age."
>) It may seem odd that the first release of Java 2 used the 1.2 version
number.It originally referred to the internal version number of the Java
libraries,but then was generalized to refer to the entire release.
>) Java 2 added a new features,such as Swing and the Collections Framework,
and it enhanced the JVM and various programming tools.
>) Java 2 affected the Thread class in which the methods suspend(),resume(),
and stop() were deprecated(strong disapproval)
>) J2SE 1.3 was the first major upgrade to the original Java 2 release.
>) Although version 1.3 contained a smaller set of changes.Program written
for version 1.2 and those for version 1.3 are source-code compatible.
>) J2SE 1.4 further enhanched several important upgrades,enhancements,
and additions in Java.
Example:- It added the new keyword assert,chained exceptions and
a channel-based I/O subsystem.It also made changes to
the Collections Framework and the networking classes.
>) Version 1.4 maintained nearly 100 percent source-code compatibility
with prior versions.
>) J2SE 5 fundamentally the scope,power,and range of the language.
>) J2SE 5 major new features :-
@) Generics
@) Annotations
@) Autoboxing and auto-unboxing
@) Enumerations
@) Enhanced,for each type of loop
@) Variable-length arguments(varags)
@) Static import
@) Formatted I/O
@) Concurrency utilies
>) Each item in the list represents a significant addition to the Java language.
Some,such as generics,the enhanced for,and varargs,introduce new syntax
elements.
>) Autoboxing and auto-unboxing alter the semantics of the language and
Annotations new dimension to programming.
>) Sun elected to increase the version number to 5 as a way of emphasizing
that a major event was taking place.Thus,it was named J2SE 5,and the
developer kit was called JDK 5.
>) In order to maintain consistency,Sun decided to use 1.5 as it internal
version number.
>) 1.5 also referred to as the developer version number.5 in J2SE 5 is
called the product version number.
*) Java SE 6:- With the release of SE 6,Sun once again decided to change
the name of the Java platform.
>) First,notice that the "2" has been dropped.Thus,the platform now has the
name Java SE,and the official product name is
Java platform ,Standard Edition 6.
>) 6 in Java SE 6 is the product version number.The internal,developer version
version number is 1.6.
>) Java SE 6 builds on the base of J2SE 5,adding incremental improvements,
enhanced the API libraries,new packages and offer improvements to the
run time.
>) Java SE 6 serves to further solidify the advances made by J2SE 5.
*) A Culture of Innovation :- Java release redefined programming for the
Internet.
>) The JVM and bytecode changed the way about security and portability.
>) Applet and Servlet made the Web come alive.
>) The Java Community Process(JCP) redefined the way that new ideas are
assimilated into the language.
>) Java has never stood still for very long,Java SE 6 is the latest release in
Java's ongoing,dynamic history.
It's really useful as well as so boring to read
ReplyDeleteAwesome. No way boring. Thanks a lot.
ReplyDelete