csci 1130 intro to computer programming in java

49
CSci 1130 Intro to Computer Programming in Java Instructor Tatyana Volk

Upload: kumiko

Post on 16-Mar-2016

78 views

Category:

Documents


7 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSci 1130 Intro to Computer Programming in Java

CSci 1130 Intro to Computer Programming in Java

Instructor Tatyana Volk

Page 2: CSci 1130 Intro to Computer Programming in Java
Page 3: CSci 1130 Intro to Computer Programming in Java

Most experts who follow Web development think that Java is the most significant thing that has been developed for the Web.

Page 4: CSci 1130 Intro to Computer Programming in Java

“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

Page 5: CSci 1130 Intro to Computer Programming in Java

History of Java (author James Gosling)

Sun, 1994 -- Oak compileris written. Naughton andJonathan Payne built anOak-ready browser calledWebRunner.

Page 6: CSci 1130 Intro to Computer Programming in Java

Sun made the decision togive the language away,but not before renaming itJava.

Page 7: CSci 1130 Intro to Computer Programming in Java

With Java in the handsof the Internetcommunity at large, allthat was needed was away to run Java applets.

Page 8: CSci 1130 Intro to Computer Programming in Java

WebRunner wasrenamed the HotJavabrowser because of atrademark conflict.

Page 9: CSci 1130 Intro to Computer Programming in Java

Netscape began supportingJava in 1995.

Page 10: CSci 1130 Intro to Computer Programming in Java

Applications-traditionalstand-alone programs.

Page 11: CSci 1130 Intro to Computer Programming in Java

Developers can build a variety of applications using Java spreadsheets word processors accounting applications asset management databases human resources sales

Page 12: CSci 1130 Intro to Computer Programming in Java

Java programs that runon the Web are calledJava applets (short forlittle applications).

Page 13: CSci 1130 Intro to Computer Programming in Java

Applets are imbeddedinto Web page. Theyare supposed to live onWeb page, not to berun on their own.

Page 14: CSci 1130 Intro to Computer Programming in Java

DukeThe first applet --

Duke waving back at his parents over the Internet -- was born.

Page 15: CSci 1130 Intro to Computer Programming in Java

Java is commonlythought of as a way tomake Web pages cool -incorporating soundor video into Webpages.

Page 16: CSci 1130 Intro to Computer Programming in Java

Java applets aredifferent from ordinaryapplications in thatthey reside on thenetwork incentralized servers.

Page 17: CSci 1130 Intro to Computer Programming in Java

The network deliversthe applet to yoursystem when yourequest them.

Page 18: CSci 1130 Intro to Computer Programming in Java

For example, let's saythat you want to checkyour personal financialportfolio.

Page 19: CSci 1130 Intro to Computer Programming in Java

You'd dial in to yourfinancial institution anduse your Web browserto log into the bank'ssystem.

Page 20: CSci 1130 Intro to Computer Programming in Java

The portfolio data willbe shipped to you alongwith the applet neededto view it.

Page 21: CSci 1130 Intro to Computer Programming in Java

Let's assume that you'reconsidering movingyour money from oneaccount to another.

Page 22: CSci 1130 Intro to Computer Programming in Java

The system will alsosend you an applet thatwill allow you tochange the rate ofinterest and length ofinvestment to perform aseries of "what-if"scenarios.

Page 23: CSci 1130 Intro to Computer Programming in Java

From the corporations'point-of-view, Java willsimplify the creationand deployment ofapplications thus savingmoney.

Page 24: CSci 1130 Intro to Computer Programming in Java

Applications created inJava can be deployedwithout modification toany computingplatform, thus savingthe costs associatedwith developingsoftware for multipleplatforms.

Page 25: CSci 1130 Intro to Computer Programming in Java

Because theapplications are storedon centralized servers,there is no longer a needto have people insertdisks or ship CD's toupdate software.

Page 26: CSci 1130 Intro to Computer Programming in Java

Interesting Applets from Java Tutorial: http://www.javasoft.com/applets/index.html

Page 27: CSci 1130 Intro to Computer Programming in Java

All browsers are now Java-enabled.

That means you can scan throughdocuments stored around the world,and, at the click of a link , activate aJava program that will come acrossthe network and run on your owncomputer.

Page 28: CSci 1130 Intro to Computer Programming in Java

The key advantage ofbeing Java-enabled isthat instead of passivetext and images appearon your screen ,calculations andinteractions can takeplace as well.

Page 29: CSci 1130 Intro to Computer Programming in Java

When the applet isembedded into page, and apage is visited by someoneusing Java-enabledbrowser (Netscape,Explorer, Sun’s HotJava,Mosaic) , the applet isautomatically sent to theuser’s computer andactivated.

Page 30: CSci 1130 Intro to Computer Programming in Java

Java allows Webdevelopers to create andautomatically deliversworking programs, notjust files, to any computeron the network.

Page 31: CSci 1130 Intro to Computer Programming in Java

You can send info backto host site .

Page 32: CSci 1130 Intro to Computer Programming in Java

Another importantproperty of Java is thatit is platform-independent.(independent of type ofcomputer you are using)

Page 33: CSci 1130 Intro to Computer Programming in Java

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

Page 34: CSci 1130 Intro to Computer Programming in Java

Designs run from simple to sophisticated,and uses range from management ofbusiness-to-business transactions... toscientific applications for sharing andanalyzing data... to scores of fun anduseful applets created for personal andconsumer use.

Page 35: CSci 1130 Intro to Computer Programming in Java

Java applets are storedon a host site in such away that they can runon any computer thathas a Java-enabledbrowser.

Page 36: CSci 1130 Intro to Computer Programming in Java

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

Page 37: CSci 1130 Intro to Computer Programming in Java

•edit

•compile

•load

•verify

•execute

Java programs go through 5 phases to be executed:

Page 38: CSci 1130 Intro to Computer Programming in Java

Development Environments (IDE)

Edit-compile cyclerepeats.Software exists whichcombines compilingand editing and allowsto switch between themat the touch of a button

Page 39: CSci 1130 Intro to Computer Programming in Java

Examples of such Java systems:

Java WorkshopVisual J++ (Microsoft) Symantec CaféVisual Age (IBM)JBuilder(Borland)

Page 40: CSci 1130 Intro to Computer Programming in Java

IDE has an build-inenhanced editor forcreating user interfacesby designing them onthe screen

Page 41: CSci 1130 Intro to Computer Programming in Java

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.

Page 42: CSci 1130 Intro to Computer Programming in Java

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.

Page 43: CSci 1130 Intro to Computer Programming in Java

LoadingThe 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.

Page 44: CSci 1130 Intro to Computer Programming in Java

Java is designed towork easily withinWWW of computersthrough commonlyavailable user-friendlysoftware calledbrowsers.

Page 45: CSci 1130 Intro to Computer Programming in Java

Java –enabled browsermeans that insidebrowser there is aprogram known asJava Virtual Machine(JVM) which can runJava for that particularcomputer.

Page 46: CSci 1130 Intro to Computer Programming in Java

The Java that comesover the Net is in astandard form knownas Bytecode.Your JVM canunderstand the appletand make it workproperly on yourcomputer.

Page 47: CSci 1130 Intro to Computer Programming in Java

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.

Page 48: CSci 1130 Intro to Computer Programming in Java

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).

Page 49: CSci 1130 Intro to Computer Programming in Java

Finally, the computer interprets the program, one bytecode at a time.