csci 1130 intro to computer programming in java
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 PresentationTRANSCRIPT
![Page 1: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/1.jpg)
CSci 1130 Intro to Computer Programming in Java
Instructor Tatyana Volk
![Page 2: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/2.jpg)
![Page 3: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/3.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/4.jpg)
“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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/5.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/6.jpg)
Sun made the decision togive the language away,but not before renaming itJava.
![Page 7: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/7.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/8.jpg)
WebRunner wasrenamed the HotJavabrowser because of atrademark conflict.
![Page 9: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/9.jpg)
Netscape began supportingJava in 1995.
![Page 10: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/10.jpg)
Applications-traditionalstand-alone programs.
![Page 11: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/11.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/12.jpg)
Java programs that runon the Web are calledJava applets (short forlittle applications).
![Page 13: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/13.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/14.jpg)
DukeThe first applet --
Duke waving back at his parents over the Internet -- was born.
![Page 15: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/15.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/16.jpg)
Java applets aredifferent from ordinaryapplications in thatthey reside on thenetwork incentralized servers.
![Page 17: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/17.jpg)
The network deliversthe applet to yoursystem when yourequest them.
![Page 18: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/18.jpg)
For example, let's saythat you want to checkyour personal financialportfolio.
![Page 19: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/19.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/20.jpg)
The portfolio data willbe shipped to you alongwith the applet neededto view it.
![Page 21: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/21.jpg)
Let's assume that you'reconsidering movingyour money from oneaccount to another.
![Page 22: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/22.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/23.jpg)
From the corporations'point-of-view, Java willsimplify the creationand deployment ofapplications thus savingmoney.
![Page 24: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/24.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/25.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/26.jpg)
Interesting Applets from Java Tutorial: http://www.javasoft.com/applets/index.html
![Page 27: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/27.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/28.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/29.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/30.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/31.jpg)
You can send info backto host site .
![Page 32: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/32.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/33.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/34.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/35.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/36.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/37.jpg)
•edit
•compile
•load
•verify
•execute
Java programs go through 5 phases to be executed:
![Page 38: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/38.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/39.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/40.jpg)
IDE has an build-inenhanced editor forcreating user interfacesby designing them onthe screen
![Page 41: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/41.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/42.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/43.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/44.jpg)
Java is designed towork easily withinWWW of computersthrough commonlyavailable user-friendlysoftware calledbrowsers.
![Page 45: CSci 1130 Intro to Computer Programming in Java](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/45.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/46.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/47.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/48.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062316/56813f4a550346895daa04e5/html5/thumbnails/49.jpg)
Finally, the computer interprets the program, one bytecode at a time.