Download CSci 1130 Intro to Computer Programming in Java

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CSci 1130 Intro to Computer
Programming in Java
Instructor Tatyana Volk
Most experts who follow Web
development think that Java is
the most significant thing that
has been developed for the
Web.
“Java may be overhyped, but it
also may be as significant to the
computer world as television
was to broadcasting.”
- U.S.News and World Report
History of Java (author James
Gosling)
Sun, 1994 -- Oak compiler
is written. Naughton and
Jonathan Payne built an
Oak-ready browser called
WebRunner.
Sun made the decision to
give the language away,
but not before renaming it
Java.
With Java in the hands
of the Internet
community at large, all
that was needed was a
way to run Java applets.
WebRunner was
renamed the HotJava
browser because of a
trademark conflict.
Netscape began supporting
Java in 1995.
Applications-traditional
stand-alone programs.
Developers can build a variety of
applications using Java
 spreadsheets
 word processors
 accounting applications
 asset management
 databases
 human resources
 sales
Java programs that run
on the Web are called
Java applets (short for
little applications).
Applets are imbedded
into Web page. They
are supposed to live on
Web page, not to be
run on their own.
Duke
The first applet --
Duke waving back
at his parents over
the Internet -- was
born.
Java is commonly
thought of as a way to
make Web pages cool incorporating sound
or video into Web
pages.
Java applets are
different from ordinary
applications in that
they reside on the
network in
centralized servers.
The network delivers
the applet to your
system when you
request them.
For example, let's say
that you want to check
your personal financial
portfolio.
You'd dial in to your
financial institution and
use your Web browser
to log into the bank's
system.
The portfolio data will
be shipped to you along
with the applet needed
to view it.
Let's assume that you're
considering moving
your money from one
account to another.
The system will also
send you an applet that
will allow you to
change the rate of
interest and length of
investment to perform a
series of "what-if"
scenarios.
From the corporations'
point-of-view, Java will
simplify the creation
and deployment of
applications thus saving
money.
Applications created in
Java can be deployed
without modification to
any computing
platform, thus saving
the costs associated
with developing
software for multiple
platforms.
Because the
applications are stored
on centralized servers,
there is no longer a need
to have people insert
disks or ship CD's to
update software.
Interesting Applets from Java
Tutorial:
 http://www.javasoft.com/applets/index.html
All browsers are now Javaenabled.
That means you can scan through
documents stored around the world,
and, at the click of a link , activate a
Java program that will come across
the network and run on your own
computer.
The key advantage of
being Java-enabled is
that instead of passive
text and images appear
on your screen ,
calculations and
interactions can take
place as well.
When the applet is
embedded into page, and a
page is visited by someone
using Java-enabled
browser (Netscape,
Explorer, Sun’s HotJava,
Mosaic) , the applet is
automatically sent to the
user’s computer and
activated.
Java allows Web
developers to create and
automatically delivers
working programs, not
just files, to any computer
on the network.
You can send info back
to host site .
Another important
property of Java is that
it is platformindependent.
(independent of type of
computer you are using)
Java includes:
 Object-oriented features
 Platform independence (truly portable
across different operating systems)
 Multithreading (different processes are
executed at the same time)
 Garbage collection (automatic memory
management)
 Networking and security features
 Internet –Web development features
Designs run from simple to sophisticated,
and uses range from management of
business-to-business transactions... to
scientific applications for sharing and
analyzing data... to scores of fun and
useful applets created for personal and
consumer use.
Java applets are stored
on a host site in such a
way that they can run
on any computer that
has a Java-enabled
browser.
Basics of a Typical Java Environment.
Java systems generally consist of several
parts:
•an environment,
•the language, the Java Applications
Programming Interface (API)
•class libraries
Java programs go through 5 phases to be executed:
•edit
•compile
•load
•verify
•execute
Development Environments
(IDE)
Edit-compile cycle
repeats.
Software exists which
combines compiling
and editing and allows
to switch between them
at the touch of a button
Examples of such Java systems:
Java Workshop
Visual J++ (Microsoft)
 Symantec Café
Visual Age (IBM)
JBuilder(Borland)
IDE has an build-in
enhanced editor for
creating user interfaces
by designing them on
the screen
The Java compiler translates the
Java program into bytecodes -- the
language understood by the Java
interpreter.
The file called with the extension
.class is created.
The Java compiler translates
Java sourse code into Java
bytecode, which is a
representation of the program
in a low-level form similar to
machine language code. The
Java interpreter reads Java
bytecode and executes it on a
specific machine.
Loading
The program must be placed in
memory before it will be executed.
This is done by the class loader that
takes the Hello.class file containing
bytecodes and transfers it into
memory. The class file can be
loaded from a disk on your system
or over the Internet.
Java is designed to
work easily within
WWW of computers
through commonly
available user-friendly
software called
browsers.
Java –enabled browser
means that inside
browser there is a
program known as
Java Virtual Machine
(JVM) which can run
Java for that particular
computer.
The Java that comes
over the Net is in a
standard form known
as Bytecode.
Your JVM can
understand the applet
and make it work
properly on your
computer.
When the browser sees the
applet in HTML document, the
browser launches the Java class
loader to load the applet. Once
the applet is loaded, the Java
interpreter in the browser
begins executing the applet.
Before the bytecodes in an applet are
executed by the Java interpreter, they
are veryfied by the bytecode veryfier.
(to ensure that files loaded from the
Internet do not violate Java security
restrictions - not to damage your files
and system).
Finally, the computer interprets the
program, one bytecode at a time.