Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 452: Programming Languages Java and its Evolution.

Similar presentations


Presentation on theme: "CSE 452: Programming Languages Java and its Evolution."— Presentation transcript:

1 CSE 452: Programming Languages Java and its Evolution

2 2 Organization of Programming Languages-Cheng (Fall 2004) Acknowledgements u Rajkumar Buyya

3 3 Organization of Programming Languages-Cheng (Fall 2004) Contents u Java Introduction u Java Features u How Java Differs from other OO languages u Java and the World Wide Web u Java Environment u Build your first Java Program u Summary and Reference

4 4 Organization of Programming Languages-Cheng (Fall 2004) Java - An Introduction u Java - The new programming language developed by Sun Microsystems in 1991. u Originally called Oak by James Gosling, one of the inventors of the Java Language. u Java -The name that survived a patent search u Java Authors: Gosling, Arthur Van, and others u Java is really “C++ -- ++ “

5 5 Organization of Programming Languages-Cheng (Fall 2004) Java Introduction u Originally created for consumer electronics (TV, VCR, Freeze, Washing Machine, Mobile Phone). u Java - CPU Independent language u Internet and Web was just emerging, so Sun turned it into a language of Internet Programming. u It allows you to publish a webpage with Java code in it.

6 6 Organization of Programming Languages-Cheng (Fall 2004) Java Milestones YearDevelopment 1990Sun decided to developed special software that could be used for electronic devices. A project called Green Project created and headed by James Gosling. 1991Explored possibility of using C++, with some updates announced a new language named “Oak” 1992The team demonstrated the application of their new language to control a list of home appliances using a hand held device. 1993The World Wide Web appeared on the Internet and transformed the text-based interface to a graphical rich environment. The team developed Web applets (time programs) that could run on all types of computers connected to the Internet.

7 7 Organization of Programming Languages-Cheng (Fall 2004) Java Milestones YearDevelopment 1994The team developed a new Web browsed called “Hot Java” to locate and run Applets. HotJava gained instance success. 1995Oak was renamed to Java, as it did not survive “legal” registration. Many companies such as Netscape and Microsoft announced their support for Java 1996Java established itself it self as both 1. “the language for Internet programming” 2. a general purpose OO language. 1997-A class libraries, Community effort and standardization, Enterprise Java, Clustering, etc..

8 8 Organization of Programming Languages-Cheng (Fall 2004) Sun white paper defines Java as: u Simple and Powerful u Safe u Object Oriented u Robust u Architecture Neutral and Portable u Interpreted and High Performance u Threaded u Dynamic

9 9 Organization of Programming Languages-Cheng (Fall 2004) Java Attributes u Familiar, Simple, Small u Compiled and Interpreted u Platform-Independent and Portable u Object-Oriented u Robust and Secure u Distributed u Multithreaded and Interactive u High Performance u Dynamic and Extensible

10 10 Organization of Programming Languages-Cheng (Fall 2004) Java is Compiled and Interpreted Text EditorCompilerInterpreter Programmer Source Code.java file Byte Code.class file Hardware and Operating System Notepad, emacs,vi javac java appletviewer netscape

11 11 Organization of Programming Languages-Cheng (Fall 2004) Compiled Languages Text EditorCompilerlinker Programmer Source Code.c file Object Code.o file Notepad, emacs,vi gcc Executable Code a.out file

12 12 Organization of Programming Languages-Cheng (Fall 2004) Total Platform Independence JAVA COMPILER JAVA BYTE CODE JAVA INTERPRETER Windows 95MacintoshSolarisWindows NT (translator) (same for all platforms) (one for each different system)

13 13 Organization of Programming Languages-Cheng (Fall 2004) Architecture Neutral & Portable u Java Compiler - Java source code (file with extension.java) to bytecode (file with extension.class) u Bytecode - an intermediate form, closer to machine representation u A interpreter (virtual machine) on any target platform interprets the bytecode.

14 14 Organization of Programming Languages-Cheng (Fall 2004) Architecture Neutral & Portable u Porting the java system to any new platform involves writing an interpreter. u The interpreter will figure out what the equivalent machine dependent code to run

15 15 Organization of Programming Languages-Cheng (Fall 2004) Rich Class Environment u Core Classes language Utilities Input/Output Low-Level Networking Abstract Graphical User Interface u Internet Classes TCP/IP Networking WWW and HTML Distributed Programs

16 16 Organization of Programming Languages-Cheng (Fall 2004) How Does Java Compares to C++ and Other OO Languages

17 17 Organization of Programming Languages-Cheng (Fall 2004) Overlap of C, C++, and Java C C++ Java

18 18 Organization of Programming Languages-Cheng (Fall 2004) Java better than C++ ? u No Typedefs, Defines, or Preprocessor u No Global Variables u No Goto statements u No Pointers u No Unsafe Structures u No Multiple Inheritance u No Operator Overloading u No Automatic Coercions u No Fragile Data Types ?

19 19 Organization of Programming Languages-Cheng (Fall 2004) Object Oriented Languages -A Comparison

20 20 Organization of Programming Languages-Cheng (Fall 2004) Java Integrates Power of Compiled Languages and Flexibility of Interpreted Languages

21 21 Organization of Programming Languages-Cheng (Fall 2004) Java Applications u We can develop two types of Java programs: Stand-alone applications Web applications (applets)

22 22 Organization of Programming Languages-Cheng (Fall 2004) Applications v/s Applets u Different ways to run a Java executable are: main Application- A stand-alone program that can be invoked from command line. A program that has a “main” method Applet- A program embedded in a web page, to be run when the page is browsed. A program that contains no “main” method

23 23 Organization of Programming Languages-Cheng (Fall 2004) Applets v/s Applications u Different ways to run a Java executable are main Application- A stand-alone program that can be invoked from command line. A program that has a “main” method Applet- A program embedded in a web page, to be run when the page is browsed. A program that contains no “main” method u Application –Executed by the Java interpreter. u Applet- Java enabled web browser.

24 24 Organization of Programming Languages-Cheng (Fall 2004) Java and World Wide Web Turning the Web into an Interactive and Application Delivery Platform

25 25 Organization of Programming Languages-Cheng (Fall 2004) What is World Wide Web ? u Web is an open-ended information retrieval system designed to be used in the Internet wide distributed system. u It contains Web pages (created using HTML) that provide both information and controls. u Unlike a menu driven system--where we are guided through a particular direction using a decision tree, the web system is open ended and we can navigate to a new document in any direction.

26 26 Organization of Programming Languages-Cheng (Fall 2004) Web Structure of Information Search/Navigation

27 27 Organization of Programming Languages-Cheng (Fall 2004) Web as a delivery Vehicle

28 28 Organization of Programming Languages-Cheng (Fall 2004) Execution of Applets Hello Hello Java <app= “Hello”> 4 APPLET Development “hello.java” AT SUN.COM The Internet hello.class AT SUN’S WEB SERVER 2 31 5 Create Applet tag in HTML document Accessing from Unimelb.edu.au The browser creates a new window and a new thread and then runs the code

29 29 Organization of Programming Languages-Cheng (Fall 2004) Significance of downloading Applets u Interactive WWW u Flashy animation instead of static web pages u Applets react to users input and dynamically change u Display of dynamic data u WWW with Java - more than a document publishing medium u http://www.javasoft.com/applets/alpha/applets/Sto ckDemo/standalone.html

30 30 Organization of Programming Languages-Cheng (Fall 2004) Power of Java and the Web u Deliver applications, not just information u Eliminate porting u Eliminate end-user installation u Slash software distribution costs u Reach millions of customers - instantly

31 31 Organization of Programming Languages-Cheng (Fall 2004) Java Development Kit u javac - The Java Compiler u java - The Java Interpreter u jdb- The Java Debugger u appletviewer -Tool to run the applets u javap - to print the Java bytecode u javaprof - Java profiler u javadoc - documentation generator u javah - creates C header files

32 32 Organization of Programming Languages-Cheng (Fall 2004) Java Environment

33 33 Organization of Programming Languages-Cheng (Fall 2004) Java Development Kit u javac - The Java Compiler u java - The Java Interpreter u jdb- The Java Debugger u appletviewer -Tool to run the applets u javap - to print the Java bytecodes u javaprof - Java profiler u javadoc - documentation generator u javah - creates C header files

34 34 Organization of Programming Languages-Cheng (Fall 2004) Process of Building and Running Java Programs Text Editor Java Source Code javac Java Class File java Outout javadoc javah jdb HTML Files Header Files

35 35 Organization of Programming Languages-Cheng (Fall 2004) Let us Try Out Building your first Java Program

36 36 Organization of Programming Languages-Cheng (Fall 2004) Hello Internet // hello.java: Hello Internet program class HelloInternet { public static void main(String args[]) { System.out.println(“Hello Internet”); }

37 37 Organization of Programming Languages-Cheng (Fall 2004) Program Processing u Compilation # javac hello.java results in HelloInternet.class u Execution # java HelloInternet Hello Internet #

38 38 Organization of Programming Languages-Cheng (Fall 2004) Simple Java Applet // HelloWorld.java import java.applet.Applet; import java.awt.*; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString (“Hello World !”,25, 25); }

39 39 Organization of Programming Languages-Cheng (Fall 2004) Calling an Applet HELLO WORLD APPLET THE HELLO WORLD APPLET

40 40 Organization of Programming Languages-Cheng (Fall 2004) Applet Execution Using AppletViewer Using Browser

41 41 Organization of Programming Languages-Cheng (Fall 2004) Java on my platform ? u Sun (SPARC) ftp://java.sun.com u Sun(x86) ftp://xm.com:/pub/ u IBM(Aix, OS/2)ftp://ncc.hursley.ibm.com/javainfo u DEC(Alpha OSF/1) http://www.gr.osf.org:8001/projects/web/java/ u SGI http://liawww.epfl.ch/~simon/java/irix-jdk.html u HP http://www.gr.osf.org:8001/projects/web/java u linux http://www.blackdown.org u AT & T http://www.gr.osf.org:8001/projects/web/java u Windows 3.1 http://www.alphaworks.ibm.com

42 42 Organization of Programming Languages-Cheng (Fall 2004) Summary u Java has emerged as a general purpose OO language. u It supports both stand alone and Internet Applications. u Makes the Web Interactive and medium for application delivery. u Provides an excellent set of Tools for Application Development. u Java is ubiquitous!


Download ppt "CSE 452: Programming Languages Java and its Evolution."

Similar presentations


Ads by Google