《JAVA语言程序设计-前言.ppt》由会员分享,可在线阅读,更多相关《JAVA语言程序设计-前言.ppt(37页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、JAVA语言程序设计张晋豫课程安排n平时成绩 30%q考勤:点名和课堂问答q上机练习q期中测验?n期末成绩 70%q考试类型:闭卷n上机安排q地点:计算学院四层机房q时间:前一次课程通知n教材nq马迪芳等!q清华/北京交通大学出版社n提高教材qJAVA核心(第二版本)qSUN MICROSYSTEMS JAVA丛书课程提纲实实际际应应用用9.Java 2 平台包平台包 10.线程和对象操作线程和对象操作11.JAVA的的I/O操作操作12.JAVA图形用户界面图形用户界面13.JAVA网络编程网络编程5.面向对象概念初步面向对象概念初步I6.面向对象概念初步面向对象概念初步II7.面向对象概念
2、初步面向对象概念初步III8.异常异常基本知识基本知识 II基基本本知知识识I1.JAVA概述概述2.JAVA的基本语法的基本语法3.程序的流程控制程序的流程控制4.数组数组参考资料n“Java程序设计与应用技术教程”,黄斐编著,21世纪高等院校计算机技术教学丛书(3),北京希望电子出版社n“Java程序设计”,唐大仕编著,北方交通大学出版社/清华大学出版社n“Java语言与面向对象程序设计”,印旻编著,清华大学出版社n“Java 2 参考大全”,Herbert Schildt,有中译本,清华大学出版社参考资料n进一步参考qThe Java Tutorial,a practical guide
3、 for programmers,qThinking in Java,2nd edition,Revision 11,2000,Bruce Eckel,qThinking in Java,3rd Edition Revision 4.0,Bruce Eckelq“Java编程思想”,第2版,候捷译,计算机科学丛书,机械工业出版社qThe Java Language Specification,2nd Edition,James Gosling,Bill Joy,Guy Steele,Gilad Bracha第一讲 JAVA概述1.JAVA的发展2.什么是JAVA?3.JAVA程序介绍4.JAV
4、A程序运行环境JAVA的发展n早期的历史1.1991年,Sun Microsystems公司建立“the Green Project”(Secretly),13个成员,目的开发消费电子类产品市场(嵌入式设备),初始选择C+语言2.1992年夏天,一种全新的、对立于处理器的语言“Oak”,产品*7设备,潜在的市场有线电视3.Green TeamFirstPerson Team(70人),电视机顶盒/video-on-demand,市场不成熟?4.James Gosling,Bill Joy,and Eric Schmidt “why not the Internet?(WWW&Internet)
5、5.在Mosaic浏览器的基础上开发“WebRunner”浏览器,“Hollywood-meets-Silicon-Valley”的两个演示(3D动态分子、线排序)JAVA的发展n早期的历史6.Java面世n1995年3月,“1.0a”7/8份二进制拷贝,“1.0a2”源代码公布在Internetn下载数量和反馈邮件剧增nOn May 23,1995,John Gage,director of the Science Office for Sun Microsystems,and Marc Andreessen,cofounder and executive vice president at
6、 NetscapeTM,stepped onto a stage and announced to the SunWorld audience that JavaTM technology was real,it was official,and it was going to be incorporated into Netscape NavigatorTM,the worlds portal to the Internet.JAVA的发展n历史记录-WhoJames Gosling:Green Team original,FirstPerson employee,original memb
7、er Java Products Group,lead engineer and keyarchitect of Java technologyBill Joy:Cofounder and vice president,Sun Microsystems,Inc.,principal designer of the University of California,Berkeley,version of the UNIX operating systemEric Schmidt:Former Sun Microsystems chief technical officer,Former Nove
8、ll chairman and CEO,Chairman of the Board and CEO,Google Inc.JAVA的发展n历史记录*7:A new SPARC based,handheld wireless PDA,with a 5 color LCD with touchscreen inputJAVA的发展n一些比较qC语言n1978年Brian Kernighan和Dennis Ritchie发表The C Programming Language,1989年12月美国国家标准化组织(ANSI)制定了C语言的标准qC+语言n1979年Bjarne Stroustrup发明
9、了带类的C(C with Class),1983年改名为C+,1997年11月标准化qJava语言n1992年Jame Gosling等发明了原型Oak语言,1995年正式公布,目前标准化工作正在进行中JCP(Java Community Process)JAVA的发展n五年回顾(19962000)q1995年nMay 23,Java technology launched q1996年1.Jan 23,JDK 1.0 software release2.May 29,first JavaOne developer conference(JavaBeans,Java Media APIs,se
10、rvlets,etc)3.July 10,50,000 people attend Sun Java Day in Tokyo4.Aug 16,Sun/Addison-Wesley(The Java Tutorial and the first Java Language Specification)5.Sep,83,000 Web pages have incorporated Java technology6.Oct 25,Sun announces first Just-In-Time(JIT)compiler for Java platform7.Oct 29,Java Card AP
11、I announced8.Dec 9,JDK 1.1 beta software releasedJAVA的发展n五年回顾(19962000)q1997年1.Feb 18,JDK 1.1 release ships2.Mar 4,Java Web Server beta and Java Servlet Developers Kit software released3.Mar 10,Java Naming and Directory Interface(JNDI)API introduced4.Mar 11,More than 220,000 downloads of JDK 1.1 sof
12、tware in just three weeks5.Apr 2,JavaOne conference(10,000 attendees,the worlds largest developer conference),Enterprise JavaBeans technology6.Aug 5,Java Media and Communication APIs released7.Aug 5,More than 100,000 downloads of JavaBeans Development Kit software8.Sep 23,Java Developer Connection p
13、rogram has 100,000+membersJAVA的发展n五年回顾(19962000)q1998年1.Jan 20,JDK 1.1 software release downloads top 2 million2.Mar 24,JavaOne conference draws 15,0003.Mar 31,Ericsson,Sony,Siemens,BEA,OpenTV and others license Java technology4.June 3,Visa launches worlds first smart card based on Visas Open Platfo
14、rm and Suns Java Card technology5.Nov 5,Sun works with Linux Community on Java 2 software port to Linux6.Dec 8,Java 2 platform shipsJAVA的发展n五年回顾(19962000)q1999年1.Jan 13,Major consumer electronics manufacturers support Java technology for digital television2.Feb 24,Java 2 platform source code release
15、d3.Mar 4,XML support for Java platform unveiled4.Mar 27,Java HotSpot performance engine unveiled5.June 2,JavaServer Pages technology unveiled6.June 15,JavaOne developer conference draws 20,0007.June 15,Sun announces three editions of Java platform:J2SE,J2EE,J2ME8.June 29,J2EE Reference Implementatio
16、n Alpha ships9.Aug 25,J2SE version 1.3 beta software released10.Aug,The JavaPhone API specification included in an approved GSM standard by the European Telecommunications Standards Institute JAVA的发展n五年回顾(19962000)q1999年11.Sep 30,J2EE beta software released12.Dec 8,J2EE platform ships13.Dec 8,J2SE p
17、latform on Linux shipsq2000年1.Apr 19,J2EE platform licensed to Art Technology Group,BEA Systems,Compaq,Hitachi,SilverStream,Sybase,.2.May,Membership in Java Developer Connection program tops 1.5 million3.May 8,Sun to work with Chinese TV industry to define interactive digital TV spec for China TV4.M
18、ay 8,J2SE v.1.3 platform released5.May 17,J2SE v 1.3 platform gains industry support from Apple with Mac OS XJAVA的发展n新的发展(2000之后)JAVA的发展JAVA的发展JAVA的发展JAVA的发展http:/第一讲 JAVA概述1.JAVA的发展2.什么是JAVA?3.JAVA程序介绍4.JAVA程序运行环境什么是JAVA?nJAVA Technology1.编程语言(Programming Language)2.运行平台(Platform)什么是JAVA?nJAVA编程语言的
19、特点1.简单(Simple)2.面向对象(Object oriented)3.解释性(Interpreted)4.平台独立和可移植(Architecture neutral&Portable)5.鲁棒和安全(Robust&Secure)6.多线程(Multithreaded)7.分布式(Distributed)8.高性能(High performance)9.动态(Dynamic)nJAVA编程语言的特点1.简单(Simple)q快速学习,具有C/C+相类似的语法qJava不存在指针2.面向对象(Object oriented)q注重于数据和操作数据的方法,而不是流程qclass类是数据和操作
20、数据的方法的集合q类是层次化结构3.解释性(Interpreted)qJava编译器生成字节码,Java解释器执行字节码q链接过程简单,仅仅将新的类装载(load)入运行环境什么是JAVA?nJAVA编程语言的特点4.平台独立(Architecture neutral)和可移植(Portable)qJava编译器产生的字节码(bytecode)可运行在异种网络环境中(不同的硬件系统和不同的操作系统)qJava程序在不同的平台中行为一致,不存在数据类型的不一致等现象什么是JAVA?nJAVA编程语言的特点5.鲁棒(Robust)和安全(Secure)q可靠的语言:compile-time che
21、cking和run-time checkingq内存管理简单,“new”构造对象,对象释放(automatic garbage collection)q网络环境的应用不会被产生入侵行为,为Java程序构造一个个(Sandbox)什么是JAVA?nJAVA编程语言的特点6.多线程(Multithreaded)q例:浏览器应用中,播听音乐/拖动页面/后台下载页面q线程类:等q原语支持:synchronized、wait()、notify()7.分布式(Distributed)q支持网络应用,.*nHTTP应用:URL类nTCP应用:Socket类、ServerSocket类nUDP应用:Datag
22、ramSocket类、DatagramPacket类什么是JAVA?nJAVA编程语言的特点8.高性能(High performance)q解释性的语言,没有C语言快q“Just-In-Time”JIT编译器,在运行时将Java字节码转变为机器码qJava HotSpot Compilers9.动态(Dynamic)qJava语言在执行的链接(link)阶段是动态的qclass类仅在需要时被链接q被链接的代码模块可以有不同的来源,从本地或从网络什么是JAVA?n平台(Platform)1.程序运行的硬件和软件环境nCPU、硬盘、内存、显卡、声卡、网卡等n操作系统:Windows、MacOS、U
23、NIX(Linux/AIX/Solaris/HPUX)n操作系统与硬件的结合nJAVA运行平台(Platform)1.JAVA虚拟机(JVM:Java Virtual Machine)nJava解释器Java开发工具或可运行applet的Web浏览器 2.JAVA应用编程接口(Java Application Programming Interface,Java API)什么是JAVA?nJAVA运行平台(Platform)1.J2SE Platform(Java 2 Standard Edition)nJava Runtime Environment(JRE)Java虚拟机、库函数、运行Ja
24、va应用程序和Applet所必须文件nJava 2 SDK(Development Kit)JRE的超集,包含编译器和调试器等用于程序开发的文件2.JAVA虚拟机、JAVA应用编程接口和系统平台的关系什么是JAVA?nJAVA平台的发展qJava Development Kit1.1.1.1 1.1.6 qJava 2 SDK2.1.4.0 1.4.1 http:/nJAVA平台的扩展q三个版本(1999.6)qJ2SE:Core/DesktopqJ2EE:Enterprise/ServerqJ2ME:Mobile/Wireless什么是JAVA?J2SETM Platform Roadmap
25、Kestrel Cricket Merlin Hopper Mantis Tiger quoted from Suns 2002 Worldwide Java Developer ConferenceSun ERC 20033 million150 million400 million680150J2EEJava developersJ2ME phones shippedJava Cards deployedJCP(Java Community Process)membersLiberty Alliance membersthe de facto standard forthe app ser
26、vernJAVA可以做什么?1.基本:Objects,strings,threads,numbers,input and output,data structures,system properties,date and time等 2.Applets应用3.网络/Web应用:URL/TCP/UDP,JSP/Servlets4.国际化应用:实现程序的本地化,并以适当的语言显示5.安全应用:电子签名、公钥和私钥管理、访问控制和用户证书等6.软件构件:JavaBeans7.对象串行化:实现远程方法执行(Remote Method Invocation,RMI)8.Java数据库连接(Java Da
27、tabase Connectivity,JDBC):提供统一的方式访问关系型数据库什么是JAVA?n为什么选择JAVA?1.快速上手(Get started quickly)2.写较少的代码(Write less code)3.写更好的代码(Write better code):garbage collection(防止内存泄漏),面向对象、JavaBeans构件机制、其他API复用代码,减少bugs4.开发程序更快(Develop programs more quickly)5.避免平台依赖性(Avoid platform dependencies with 100%Pure Java)6.编写一次,随处运行(Write once,run anywhere)machine-independent bytecodes7.发布软件更容易(Distribute software more easily):指对软件的更新,利用动态加载功能,一处改动,自动更新,不用重新编译整个程序什么是JAVA?
限制150内