Java语言概述与面向对象思想--中英文翻译

发布时间:   来源:文档文库   
字号:

毕业设计(论文外文资料翻译

件:1.外文资料翻译译文;2.外文原文。
指导教师评语:

签名:






Java语言概述与面向对象思想
Java是由SunMicrosystems公司于19955月推出的Java程序设计语言和Java的总称。用Java实现的HotJava浏览器(支持Javaapplet)显示Java的魅力:跨平台、动态的WebInternet计算。从此,Java被广泛接受并推动了Web的迅速发展,常用的浏览器现在均支持Javaapplet
平台
Java平台由Java虚拟机(JavaVirtualMachine)和Java应用编程接口ApplicationProgrammingInterface、简称API)构成。Java应用编程接口Java应用提供了一个独立于操作系统的标准接口,可分为基本部分和扩展部分。在硬件或操作系统平台上安装一个Java平台之后,Java应用程序就可运行。现在Java平台已经嵌入了几乎所有的操作系统。这样Java程序可以只编译一次,就可以在各种系统中运行。Java应用编程接口已经从1.1x版发展到1.2版。目前常用的Java平台基于Java1.5,最近版本为Java1.7
Java分为三个体系JavaSE(Java2PlatformStandardEditionjava平台标准版JavaEE(Java2Platform,EnterpriseEditionjava平台企业版JavaME(Java2PlatformMicroEditionjava平台微型版
JavaSE
JAVA
*JavaSEJavaPlatformStandardEditionJavaSE以前称为J2SE它允许开发和部署在桌面、服务器、嵌入式环境和实时环境中使用的Java应用程序。JavaSE包含了支持JavaWeb服务开发的类,并为JavaPlatformEnterpriseEditionJavaEE)提供基础。
JavaEE
*JavaEEJavaPlatformEnterpriseEdition)。这个版本以前称J2EE企业版本帮助开发和部署可移植、健壮、可伸缩且安全的服务器端Java应用程序。JavaEE是在JavaSE的基础上构建的,它提供Web服务、组件模型、管理和通信API,可以用来实现企业级的面向服务体系结构service-orientedarchitectureSOA)和Web2.0应用程序。
JavaME

*JavaMEJavaPlatformMicroEdition)。这个版本以前称为J2MEJavaME为在移动设备和嵌入式设备(比如手机、PDA、电视机顶盒和打印机)上运行的应用程序提供一个健壮且灵活的环境。JavaME包括灵活的用户界面、健壮的安全模型、许多内置的网络协议以及对可以动态下载的连网和离线应用程序的丰富支持。基于JavaME规范的应用程序只需编写一次,就可以用于许多设备,而且可以利用每个设备的本机功能。
名字起源
Java1995诞生,至今已经16年历史。Java的名字的来源:Java是印度尼西亚爪哇岛的英文名称,因盛产咖啡而闻名。Java语言中的许多库类名称,多与咖啡有关,JavaBeans(咖啡豆NetBeans(网络豆以及ObjectBeans(象豆等等。SUNJAVA的标识也正是一杯正冒着热气的咖啡。
JamesGosling回忆,最初这个为TV机顶盒所设计的语言在Sun内部一直称为Green项目。我们的新语言需要一个名字。Gosling注意到自己办公室一棵茂密的橡树Oak,这是一种在硅谷很常见的树。所以他将这个新语言命名为Oak。但Oak是另外一个注册公司的名字。这个名字不可能再用了。
在命名征集会上,大家提出了很多名字。最后按大家的评选次序,将十几个名字排列成表,上报给商标律师。排在第一位的是Silk(丝绸。尽管大家都喜欢这个名字,但遭到JamesGosling的坚决反对。排在第二和第三的都没有通过律师这一关。只有排在第四位的名字、得到了所有人的认可和律师的通过,这个名字就是Java
10多年来,Java就像爪哇咖啡一样誉满全球,成为实至名归的企业级应用平台的霸主。而Java语言也如同咖啡一般醇香动人。
早期的Java
Java平台和语言最开始只是升阳公司在199012开始研究的一个内部项目。升阳公司的一个叫做帕特里克·诺顿的工程师被升阳自己开发的CC言编译器搞得焦头烂额,因为其中的API极其难用。帕特里克决定改用NeXT同时他也获得了研究公司的一个叫做“Stealth计划”的项目的机会。
“Stealth计划”后来改名为“Green计划”,詹姆斯·高斯林和麦克·舍林丹也加入了帕特里克的工作小组。他们和其他几个工程师一起在加利福尼亚州门罗帕克市沙丘路的一个小工作室里面研究开发新技术,瞄准下一代智能家电(如微波炉)的程序设计,升阳公司预料未来科技将在家用电器领域大显身手。团队最初考虑使用C语言,但是很多成员包括升阳的首席科学家比尔·乔伊,发现C和可用的API在某些方面存在很大问题。
工作小组使用的是内嵌类型平台,可以用的资源极其有限。很多成员发现C太复杂以至很多开发者经常错误使用。他们发现C缺少垃圾回收系统,还有可移植的安全性、分布程序设计、和多线程功能。最后,他们想要一种易于移植到各种设备上的平台。
根据可用的资金,比尔·乔伊决定开发一种集C语言和Mesa语言大成的新语言,在一份报告上,乔伊把它叫做“未来”,他提议升阳公司的工程师应该在

C的基础上,开发一种面向对象的环境。最初,高斯林试图修改和扩展C的功能,他自己称这种新语言为C--,但是后来他放弃了。他将要创造出一种全新的语言,被他命名为“Oak”(橡树),以他的办公室外的树而命名。
就像很多开发新技术的秘密的工程一样,工作小组没日没夜地工作到了1992年的夏天,他们能够演示新平台的一部分了,包括Green操作系统,Oak的程序设计语言,类库,和其硬件。最初的尝试是面向一种类PDA设备,被命名Star7这种设备有鲜艳的图形界面和被称为“Duke”的智能代理来帮助用户。1992123日,这台设备进行了展示。
同年11月,Green计划被转化成了“FirstPerson有限公司”,一个升阳公司的全资子公司,团队也被重新安排到了帕洛阿尔托。FirstPerson团队对建造一种高度互动的设备感兴趣,当时代华纳发布了一个关于电视机顶盒的征求提议书时(Requestforproposal),FirstPerson改变了他们的目标,作为对征求意见书的响应,提出了一个机顶盒平台的提议。但是有线电视业界觉得FirstPerson的平台给予用户过多地控制权,因此FirstPerson的投标败给了SGI3DO公司的另外一笔关于机顶盒的交易也没有成功,由于他们的平台不能在电视工业产生任何效益,公司再并回升阳公司。
第一个JAVA程序HelloWorld

//文件名HelloWorld.java
//声明一个类publicclassHelloWorld{//声明一个方法
publicstaticvoidmain(Stringargs[]{//程序的入口//输出
System.out.println(“helloworld!”;}}
//例子
packageText;
publicclassTest{
publicstaticvoidmain(Stringargs[]{shortd=12;//短整型
System.out.println(d;//输出dlongc=144L;//长整型,要加lSystem.out.println(c;//输出cintz=15;//整型
System.out.println(z;//输出zchare='';//字符型“我”System.out.println(e;//输出e}}
//无编译工具编译运行java程序//路径是相对路径

编译java
javac[java源程序名称.java]//一定要加上后缀名
//这个时候你会发现你的原程序旁边多了一个.class文件,文件名和源文件名称相同
//有编译错误会提示运行java
java[java源程序名称]//不需要加后缀名,自动运行.class文件//显示程序运行结果
JAVA遭遇互联网


JAVA应用
199467月间,在经历了一场历时三天的头脑风暴的讨论后,约翰·盖吉、詹姆斯·高斯林、比尔·乔伊、帕特里克·诺顿、韦恩·罗斯因和埃里克·斯库米,团队决定再一次改变了努力的目标,这次他们决定将该技术应用于万维网。他们认为随着Mosaic浏览器的到来,因特网正在向同样的高度互动的远景演变,而这一远景正是他们在有线电视网中看到的。作为原型,帕特里克·诺顿写了一个小型万维网浏览器,WebRunner后来改名为HotJava同年,Oak改名为Java商标搜索显示,Oak已被一家显卡制造商注册,因此团队找到了一个新名字。这个名字是在很多成员常去的本地咖啡馆中杜撰出来的。名字是不是首字母缩写还不清楚,很大程度上来说不是。虽然有人声称是开发人员名字的组合:JamesGosling(詹姆斯·高斯林)ArthurVanHoff(阿瑟·凡·霍夫)Andy
Bechtolsheim(安迪·贝克托克姆),或“JustAnotherVagueAcronym”(只是另外一个含糊的缩写)还有一种比较可信的说法是这个名字是出于对咖啡的喜爱,所以以Java咖啡来命名。类文件的前四个字节如果用十六进制阅读的话,分别为CAFEBABE,就会拼出两个单词“CAFEBABE”(咖啡宝贝)。
199410月,HotJavaJava平台为公司高层进行演示。1994年,Java1.0a版本已经可以提供下载,但是JavaHotJava浏览器的第一次公开发布却是在1995323SunWorld大会上进行的。升阳公司的科学指导约翰·盖吉宣告Java技术。这个发布是与网景公司的执行副总裁马克·安德森的惊人发布一起进行的,宣布网景将在其浏览器中包含对Java的支持。19961月,升阳公司成立了Java业务集团,专门开发Java技术。
回眸贡献
20090420日,oracle(甲骨文宣布收购sun
1991年,Sun公司的JamesGoslingBillJoe等人,为电视、控制烤面包机等家用电器的交互操作开发了一个Oak(一种橡树的名字)软件,他是Java

的前身。当时,Oak并没有引起人们的注意,直到1994年,随着互联网和3W飞速发展,他们用Java编制了HotJava浏览器,得到了Sun公司首席执行官ScottMcNealy的支持,得以研发和发展。为了促销和法律的原因,1995Oak更名为JavaJava的得名还有段小插曲呢,一天,Java小组成员正在喝咖啡时,议论给新语言起个什么名字的问题,有人提议用JavaJava是印度尼西亚盛产咖啡的一个岛屿),这个提议得到了其他成员的赞同,于是就采用Java命名此新语言。很快Java被工业界认可,许多大公司如IBMMicrosoft.DEC购买了Java的使用权,并被美国杂志PCMagazine评为1995年十大优秀科技产品。从此,开始了Java应用的新篇章。
Java的诞生是对传统计算机模式的挑战,对计算机软件开发和软件产业都产生了深远的影响:
1软件4A目标要求软件能达到任何人在任何地方在任何时间对任何电子设备都能应用。这样能满足软件平台上互相操作,具有可伸缩性和重用性并可即插即用等分布式计算模式的需求。
2)基于构建开发方法的崛起,引出了CORBA国际标准软件体系结构和多层应用体系框架。在此基础上形成了Java.2平台和.NET平台两大派系,推动了整个IT业的发展。
3)对软件产业和工业企业都产生了深远的影响,软件从以开发为中心转到了以服务为中心。中间提供商,构件提供商,服务器软件以及咨询服务商出现。企业必须重塑自我,B2B的电子商务将带动整个新经济市场,使企业获得新的价值,新的增长,新的商机,新的管理。
4)对软件开发带来了新的革命,重视使用第三方构件集成,利用平台的基础设施服务,实现开发各个阶段的重要技术,重视开发团队的组织和文化理念,协作,创作,责任,诚信是人才的基本素质。
总之,目前以看到了Java对信息时代的重要性,未来还会不断发展,Java在应用方面将会有更广阔的前景。1.1Java语言的发展1.1.1Java语言的产生
上世纪90年代初期,Sun公司在研究一种适用于未来的智能设备的编程语言,该语言要具有一些新的特性,以避免C++的一些不足。
该语言起初命名为Oak,来源于语言作者Gosling办公室窗外的一棵橡树Oak后来在注册时候遇到了冲突,于是就从手中的热咖啡联想到了印度尼西亚一个盛产咖啡的岛屿,中文名叫爪哇,Java语言得名于此。
随着Internet的迅速发展,Web应用日益广泛,Java语言也得到了迅速发展。1994年,GoslingJava开发了一个实时性较高、可靠、安全、有交互功能的新Web浏览器,它不依赖于任何硬件平台和软件平台。这种浏览器名称为HotJava并于1995年同Java语言一起,正式在业界对外发表,引起了巨大的轰动,Java的地位随之而得到肯定。此后的发展非常迅速。
Java编程语言的句法与C++的句法相似,语义则与SmallTalkTM的语义相似。Java编程语言可被用来创建任何常规编程语言所能创建的应用程序。
设计Java编程语言的主要目标是:提供一种易于编程的语言,从而消除其它语言在诸如指针运算和存储器管理方面影响健壮性的缺陷。
利用面向对象的概念使程序真正地成为完全面向对象的程序。

为使代码尽可能清晰合理、简明流畅提供了一种方法。为获得如下两点益处提供一种解释环境:
提高开发速度──消除编译─链接—装载—测试周期;
代码可移植性──使操作系统能为运行环境做系统级调用。为运行不止一个活动线程的程序提供了一种方式。通过允许下载代码模块,从而当程序运行时也能动态支持程序改变。为那些保证安全性而装载的代码模块提供了一种检查方法。
精心开发的Java核心技术为上述目标的实现提供了保证,其中包括如下几个主要技术:
Java虚拟机自动垃圾收集代码安全性
1.1.2Java语言的发展
Java语言的发展目标并不仅仅是一种编程语言,同时还要构建一种开发环境、一种应用环境、一种部署环境。
作为Java语言的最基本支持,Sun公司在1996年发布了Java开发工具包JDK1.0JDKJavaDevelopKit的简称),其中包括了进行Java开发所需要的各种实用程序(编译、执行、文档生成器等等)、基本类库(相当于C语言的函数库以C++的类库)、程序实例等等。1998年,Sun公司发布了更新的JDK1.2,由于在技术思想方面与以前有很多改进,所以此后的Java技术一般称之为Java2后,针对不同的领域特征,Java技术分为三种不同的平台(最新的称谓又去掉了意义模糊的2,如JavaSE
J2SE——标准Java平台
J2SEJava语言的标准版,指的就是JDK1.2及其以后版本),包含Java基础类库和语法。它用于开发具有丰富的GUI(图形用户界面)、复杂逻辑和高性能的桌面应用程序。
J2EE——企业级Java平台
J2EE建立在J2SE之上,用于开发和实施企业级应用程序。它是一个标准的多层体系结构,可以将企业级应用程序划分为客户层、表示层、业务层和数据层,主要用于开发和部署分布式、基于组件、安全可靠、可伸缩和易于管理的企业级应用程序。
J2ME——嵌入式Java技术平台
J2ME也是建立在J2SE之上,主要用于开发具有有限的连接、内存和用户界面能力的设备应用程序。例如移动电话(手机)PDA(电子商务)、能够接入电缆服务的机顶盒或者各种终端和其他消费电子产品。
任何语言建立的应用程序的类型或多或少都与应用程序的运行环境有关,Java语言一般可以建立如下的两种程序:
Applications
Applications是一种独立的程序,它是一种典型的通用程序,可运行于任何具备Java运行环境的设备中。
Applets
Applets是一种贮存于WWW服务器上的用Java编程语言编写的程序,它通常由浏览器下载到客户系统中,并通过浏览器运行。Applets通常较小,以减少下载时间,它由超文本标识语言(HTML)的Web页来调用。

Java运行环境具有一些特殊性,或者有很多特殊的人为建立的运行环境,Java编程中经常建立各种组件,它们可以在特定环境中运行,如ServletJavaBeanJSP等。
Java技术体系中,有很多免费或非免费的第三方Java组件,他们往往提供了某一方面的解决方案,可以应用在很多项目的开发过程中。
学习Java语言需要逐渐了解Java技术体系,从局部细节开始学习,从整体中进行认识并选择方向,从应用中进行巩固提高。
1.2Java语言的特点
Java语言适用于Internet环境,是一种被广泛使用的网络编程语言,它具有如下的一些特点:
简单
Java语言的语法规则和C++类似,Java语言取消了指针和多重继承,统一使用引用来指示对象C++中有两种形式,实际上是两种产生对象的途径,Java中只有一种),通过自动垃圾收集免去了程序设计人员对于内存块的释放工作。
面向对象(近于完全)
Java语言为了提高效率,定义了几个基本的数据类型以非类的方式实现,下的所有数据类型都以类的形式进行封装,程序系统的构成单位也是类。因而几乎可以认为是完全面向对象。
平台无关性(可移植、跨平台)
Java虚拟机(JVM)是在各种体系结构真实机器中用软件模拟实现的一种想象机器,必要时候可以用硬件实现。
当然,这些虚拟机内部实现各异,但其功能是一致的——执行统一的Java虚拟机指令。
Java编译器将Java应用程序的源代码文件(.java)翻译成Java字节码文件.class,它是由Java虚拟机指令构成的。由于是虚拟机器,因而Java虚拟机执Java程序的过程一般称为解释。
依赖于虚拟机技术,Java语言具有与机器体系结构无关的特性,即Java序一旦编写好之后,不需进行修改就可以移植到任何一台体系结构不同的机器上。
从操作系统的角度看,执行一次Java程序的过程就是执行一次Java虚拟机进程的过程。
面向网络编程
Java语言产生之初就面向网络,在JDK中包括了支持TCP/IPHTTPFTP等协议的类库。
多线程支持
多线程是程序同时执行多个任务的一种功能。多线程机制能够使应用程序并行执行多项任务,其同步机制保证了各线程对共享数据的正确操作。
良好的代码安全性
运行时(Runtime)一词强调以动态的角度看程序,研究程序运行时候的动态变化,也用运行时环境一词表达类似的含义。
Java技术的很多工作是在运行时完成的,如加强代码安全性的校验操作。一般地,Java技术的运行环境执行如下三大任务:加载代码——由类加载器执行
类加载器为程序的执行加载所需要的全部类(尽可能而未必同时)校验代码——由字节码校验器执行

Java代码在实际运行之前要经过几次测试。字节码校验器对程序代码进行四遍校验,这可以保证代码符合JVM规范并且不破坏系统的完整性。如--检查伪造指针、违反对象访问权限或试图改变对象类型的非法代码。
执行代码——由运行时的解释器执行自动垃圾收集
许多编程语言都允许在程序运行时动态分配内存块,分配内存块的过程由于语言句法不同而有所变化,但总是要返回指向存储区起始位置的指针。
CC++及其它一些语言中,程序员负责取消分配内存块。有时这是一件很困难的事情。因为程序员并不总是事先知道内存块应在何时被释放。当在系统中没有能够被分配的内存块时,可导致程序瘫痪,这种程序被称作具有内存漏洞。
当分配内存块不再需要时,程序或运行环境应取消分配内存块。垃圾收集就是将不再需要的已分配内存块回收。在其它一般的语言中,取消分配是程序员的责任。Java编程语言提供了一种系统级线程以跟踪存储区分配,来完成垃圾收集:
可检查和释放不再需要的存储块可自动完成上述工作可在JVM实现周期中,产生意想不到的变化良好的代码健壮性
Java能够检查程序在编译和运行时的错误。类型检查能帮助用户检查出许多在开发早期出现的错误。同时很多集成开发工具IDE的出现使编译和运行Java程序更加容易,并且很多集成开发工具(如Eclipse)都是免费的。

1.3面向对象与面向过程的差异
一种程序设计语言的产生,不仅是程序设计技术的改进,也包含了表达和认知思想的进步。
C语言为代表的部分早期语言,被称为面向过程的语言,不仅因为其程序设计的表达形式是以过程为基本元素,本质上更在于此时对计算机化的系统的理解的主导思想还是控制流或者数据流的,构成系统的要素是模块——处理逻辑。
面向对象语言的产生,是因为对于系统的理解或抽象到了更为高级的层次。此时的认知思想不仅更接近于现实世界,其抽象程度也很高。因而,既有易懂的一方面,也有难懂的另一方面,就看理解的境界了。
1.3.1面向过程思想回顾
面向过程思想和程序设计语言的体现,可以简单总结为以下几条:对系统的认识采用结构化分析的过程——自顶向下,逐步求精地进行功能分解;
每个功能就是处理数据的一个模块,因而IPO描述充分刻画了模块的内外特征;
每个模块都是控制流的,因而有典型的三种程序结构——顺序、分支、循环;模块间的关系通过调用维系,因而模块成为了函数,这也是面向过程方式下最主要的代码重用方式;
尽管函数调用有参数和返回值,但数据总是和函数分开的,不仅有了著名的断言——程序=算法+数据,也使得绝对平等产生了无序的麻烦——所有的函数和数据的关联关系没有限制;

如果要使用数据流,那么只能是在数据产生之后的适当时机调用函数。这一时期的主要缺点是:对系统的理解比较难,系统地开发效率低,代码的可重用性差。
1.3.2面向对象思想介绍面向对象思想,对现实世界采用直观的理解,计算机化时候采用深度的抽象,简单地可以总结如下:
系统是由事物构成的,事物之间是有联系的,复杂的事物也是系统;系统与系统、系统与事物、事物与事物之间是有明确界限(边界)的;系统或事物的状态刻画可以用属性表示,属性一般是些简单的数据,如果复杂那就是事物了;
系统或事物的状态会发生变化,称为行为,产生变化是有原因的(内部的或外部的),变化的过程可能是复杂的;
不同的事物之间会具有共同的属性和行为,共同的极端情形就是完全包含。基于以上的认识,一个运行时(动态)的具体系统或事物,是由几个更小的具体事物构成(极端的事物就是一个简单的属性数据)它们是不断发生变化的。如果对事物这一概念进行了有效的抽象,那么问题就迎刃而解。
首先,将任何一个具体的事物称为对象Object,它的极端情形就是过去的变量;事物是分类的,每一类事物都具有统一的属性和行为,即类型——抽象数据类型,简称为类Class行为既然是过程,那么就抽象成函数,命名为方法,以示区别。
例如:
描述身高或姓名,各自只是一个简单的数据变量;描述一个学生,可以使用学号、姓名、宿舍、班级等;那更换宿舍算什么呢!那描述宿舍、班级,又要有许多个项目。
1.4面向对象程序设计中的主要概念和特征
面向对象程序设计ObjectOrientedProgrammingOOP语言中,为了进行更为高度的抽象,会引入一些现实世界中难于找到的概念,但对于一个程序语言来说确实很有价值的。以下暂时介绍的概念基本上都来源于对现实世界的抽象,要从程序设计的角色中去理解它们。
面向对象程序设计使系统更易于理解,也使代码具有更好的重用性、可扩展性、易于管理和维护。
1.4.1主要概念1、类
类是对一类事物的抽象表示,其角色就相当于数据类型,当然可以算作复杂的数据类型。如学生、宿舍、班级。
2、对象
对象表示一个具体的事物,其角色就是变量,即一个复杂数据类型——xx类的变量。如周瑜、张飞、瑜飞居,飞虎班。
3、成员
一个事物的构成元素,讨论类的时候就是虚拟的,讨论对象的时候就是具体的。如在类中,一个变量属于成员——成员变量,一个对象也属于成员——成员对象,一个函数也属于成员——成员方法。
1.4.2主要特征

OOP语言有三个特征:封装、继承及多态性。1、封装
类的构成包括成员变量/对象与成员方法,这样将相关的数据与函数包装在一起,同其他的类相区分,就是封装。显然,避免了面向过程语言的平行缺陷,说明了类和成员之间的所属关系。进一步地,可以限制类的成员在外部的可见性,那么就将封装体现得更完美。
2、继承
当一种事物甲完全是另一种事物乙的特例,那么,一般地,类甲只是比类乙多出一些成员变量/对象与成员方法,称为类甲继承类乙,类甲称为(类乙的)子类,类乙称为(类甲的)父类。
父类也称为基类、超类,子类也称为导出类、派生类。
显然编写子类就没有必要重复书写父类中乙有的代码部分,这是OOP中最典型的代码重用。
3、多态
多态表示一个类的某种行为存在多种实现版本。简单的情况是在一个类中,给出多种不同的实现,复杂的情况是在多个子类中各自给出不同的实现。
*1.5JavaC++的差异1.6本章小结习题
1.解释Java语言的三种平台。
2.解释支撑Java语言目标的三种主要技术(自查资料完善)
3.关于面向对象与面向过程的不同,从问题理解和问题表示两种角度,按照个人的理解和认识,例示其不同的地方



OverviewofJavalanguage
Java,fromSunMicrosystems,launchedinMay1995oftheJavaprogramminglanguageandJavaingeneral.HotJavaimplementationwithJavabrowser(supportingJavaappletshowsthecharmofJava:cross-platform,dynamicWeb,Internetcomputing.Sincethen,JavaiswidelyacceptedandpromotedtherapiddevelopmentofWeb,popularbrowsersnowsupportJavaapplet.
Platform
JavaplatformbytheJavaVirtualMachine(JavaVirtualMachineandJavaapplicationprogramminginterfaces(ApplicationProgrammingInterface,referredtoasAPIcomposition.JavaapplicationprogramminginterfaceforJavaapplicationsindependentoftheoperatingsystemofastandardinterface,canbedividedintothebasicpartandextension.Inthehardwareoroperatingsystemplatform,afterinstallingaJavaplatform,Javaapplicationscanrun.EmbeddedJavaplatformnowhasalmostalltheoperatingsystems.ThisJavaprogramcanonlycompileitonce,youcanrunavarietyofsystems.Javaapplicationprogramminginterfacehasbeendevelopedfroma1.1xversiontoversion1.2.TheJavaplatformisbasedonthecommonlyusedJava1.5,arecentversionJava1.7.
JavaisdividedintothreesystemsJavaSE(Java2PlatformStandardEdition,javaplatformstandardedition,JavaEE(Java2Platform,EnterpriseEdition,javaplatformenterpriseedition,JavaME(Java2PlatformMicroEdition,javaplatform,MicroEdition.JavaSEJAVA
*JavaSE(JavaPlatform,StandardEdition.JavaSEformerlyknownasJ2SE.Itallowsdevelopmentanddeploymentonthedesktop,server,embeddedandreal-timeenvironmentusingtheJavaenvironmentapplications.JavaSEincludessupportforJavaWebservicesdevelopmentclasses,andfortheJavaPlatform,EnterpriseEdition(JavaEEtoprovideabasis.JavaEE
*JavaEE(JavaPlatform,EnterpriseEdition.ThisversionformerlyknownasJ2EE.EnterpriseEditiontohelpdevelopanddeployportable,robust,scalableandsecureserver-sideJavaapplications.JavaSEJavaEEisbuiltonthefoundation,whichprovidesWebservices,componentmodel,managementandcommunicationAPI,canbeusedtoachieveenterpriseclassservice-orientedarchitecture(service-orientedarchitecture,SOAandWeb2.0applicationsprogram.JavaME
*JavaME(JavaPlatform,MicroEdition.ThisversionformerlyknownasJ2ME.JavaMEdevicesinmobileandembeddeddevices(suchasmobilephones,PDA,TVset-topboxesandprintersapplicationsrunningonarobustandflexibleenvironment.JavaMEincludesflexibleuserinterfaces,robustsecuritymodel,andmanybuilt-innetworkprotocolsandnetworkingthatcanbedynamicallydownloadedtherichandofflineapplicationsupport.SpecificationbasedonJavaMEapplicationsarewrittenonce,canbeusedinmanydevices,andcanuseeachdevice'snativecapabilities.Originofname

ThebirthofJavasince1995,ithasbeen16years.ThenameofthesourceJava:JavaistheEnglishnameoftheIndonesianislandofJava,knownforrichcoffee.ManylibrariesintheJavalanguageclassname,moreandmorecoffee,suchasJavaBeans(coffeebeans,NetBeans(WebBeansandObjectBeans(Objectbeanandsoon.SUNandJAVAidentityiswhatissteamingcupofcoffee.
AccordingtoJamesGoslingmemories,TVset-topboxwasoriginallydesignedthisasthelanguagehasbeencalledtheGreeninSuninternalproject.Ournewlanguageneedsaname.GoslingnotedthathisthickoaktreeoutsidetheofficeofOak,whichisaverycommontreeintheSiliconValley.SohenamedthisnewlanguageOak.ButtheOakisanotherregisteredcompanyname.Thenamecannotbeusedagain.
Callthemeetinginthename,wemadealotofnames.Finalselectionbyourorderofadozennameswillbearrangedinthetable,reportedtotheAttorney.RankedfirstintheSilk(silk.Althoughwelikethename,butwasfirmlyopposedtoJamesGosling.Cameinsecondandthirddidnotpassthehurdleoflawyers.Onlythenameinfourthplace,gotalltherecognitionandadoptionlawyers,thenameisJava.
10years,JavaasJava,asworldfamouscoffee,asdeservedthedominantplatformforenterpriseapplications.TheJavalanguageislikeacoffeegenerallymellowandmoving.EarlyJava
Javaplatformandlanguageisjustthebeginningof12in1990,SunMicrosystemsbegantostudyaninternalproject.SunMicrosystems,anamedPatrickNortonSunengineersaredevelopingtheirownCandCcompilerwhipped,becausetheAPIisextremelydifficulttouse.PatrickdecidedtoswitchtoNeXT,healsoreceivedacompanycalled"Stealth,"theproject'sopportunities.
"StealthPlan"laterrenamed"GreenPlan",JamesGoslingandMike••ShelinDanPatrickhasalsojoinedtheworkinggroup.TheyandseveralotherengineersinCalifornia,SandHillRoadMenloParkCitystudioinsideasmallresearchanddevelopmentofnewtechnologies,aimedatthenextgenerationofintelligenthomeappliances(egmicrowaveovensprogramming,SunMicrosystemsisexpectedthatfuturetechnologywillbeappliancesareasoftheirtalents.TeaminitiallyconsideredusingtheClanguage,butmanymembersincludeSunMicrosystemschiefscientistBillJoy•andfoundthatCandtheavailableAPIinsomerespectsthereisabigproblem.
Workinggroupsareembeddedtypeofplatform,canbeextremelylimitedresources.ManymembersfindthatCistoocomplexaswellasmanydevelopersoftenusedincorrectly.TheyfoundthatthelackofgarbagecollectionsystemC,aswellasthesafetyofportable,distributedprogramming,andmulti-threadingcapabilities.Finally,theywantaneasymigrationtoavarietyofdeviceplatforms.
Accordingtoavailablefunds,BillJoydecidedtodevelopasetof•ClanguageGreatlanguageandnewlanguageMesa,inareport,Joeycalledit"thefuture",heproposedthatSun'sengineersshouldbeC,Basedonthedevelopmentofanobject-orientedenvironment.Initially,GoslingattempttomodifyandextendthefunctionofC,hesaidthenewlanguageisC-,butlaterhegaveup.Hewillhavetocreateanewlanguage,whichhenamed"Oak"(Oaktothetreeoutsidehisofficenamed.
Likemanyofthesecretdevelopmentofnewtechnologyprojects,theWorkingGrouptoworkdayandnighttothesummerof1992,theyareabletodemonstrateapartofthenew

platform,includingtheGreenOperatingSystem,Oakprogramminglanguage,libraries,anditshardware.FirstattemptisaclassforPDAdevices,namedStar7,thisdevicehasbrightgraphicalinterfaceandisknownas"Duke"intelligentagentstohelpusers.December3,1992,thisequipmentwasdisplayed.
InthesameyearinNovember,Greenplanstobetransformedinto"FirstPersonLimited",awhollyownedsubsidiaryofSunMicrosystems,theteamwasrelocatedtothePaloAlto.FirstPersonteambuildinginterestinahighlyinteractivedevices,whenTimeWarnerissuedarequestforproposalsontheTVset-topboxbook(Requestforproposal,FirstPersonchangedtheirgoaltoseeksubmissionsasaresponsetoproposedproposedaset-topboxplatform.ButthecableindustrythatFirstPersonplatformtogiveuserstoomuchcontrol,solosttotheFirstPersontenderSGI.3DOCompanyandtheotheratransactionontheset-topboxdoesnotsucceed,becauseoftheirplatformcannotproduceanybenefitinthetelevisionindustry,thecompanypickedupagainandyangcompany.
ThefirstJAVAprogramHelloWorld//FileNameHelloWorld.java
//DeclareaclasspublicclassHelloWorld{//Declareamethod
publicstaticvoidmain(Stringargs[]{//importprocedures//Output
System.out.println("helloworld!";}}
//ExamplepackageText;
publicclassTest{
publicstaticvoidmain(Stringargs[]{shortd=12;//short-integer
System.out.println(d;//outputd
longc=144L;//longinteger,andtoraiselSystem.out.println(c;//outputcintz=15;//integer
System.out.println(z;//outputzchare='I';//character"I"System.out.println(e;//outpute}}
//Nocompilertooltocompileandrunjavaprogram//Pathisrelativepath
Compilejava
javac[javasourcename.java]//mustbecoupledwithextension
//Thistimeyouwillfindmorethanyouroriginalonenexttotheprogram.Classfiles,filenamesandsourcefileswiththesamename//Acompileerrorwillbepromptedto

Runjava
java[javasourcename]//donotneedtoaddextensions,automaticoperation.classfiles//DisplayprogramrunningresultsJAVAhittheInternet

JAVAapplications
6,7andJuly1994,afterathree-daybrainstormingdiscussion,JohnCoverKyrgyzstan•JamesGosling,BillJoy•Patrick•Norton,andEricWayne•Rossforg•SiKumi,theteamdecidedtochangethegoalagain,thistimetheydecidedtoapplythetechnologytotheWorldWideWeb.TheybelievethatwiththearrivalofMosaicbrowser,theInternetishighlyinteractivetothesamevisionofevolution,andthisvisionofwhattheyseeinthecabletelevisionnetwork.Asaprototype,Patrick•Nortonwroteasmallwebbrowser,WebRunner,laterrenamedHotJava.Inthesameyear,OakwasrenamedJava.Trademarksearchshows,Oakhasbeenregistered,agraphicscardmanufacturer,sotheteamfoundanewname.Thenameisfrequentedbymanymembersofthelocalcoffeeshopinthecoined.Acronymnameisnotyetclear,largelyfornot.Althoughthedeveloperclaimsthatthenameisacombinationof:JamesGosling(JamesGoslingArthurVanHoff(Arthur•Where•HoffAndyBechtolsheim(Andy•贝克托克姆,or"JustAnotherVagueAcronym"(justanothervagueacronym.Thereisalsoamorecredibleargumentisthatthenameisbasedonaloveofcoffee,sonamedforthecoffeetoJava.Classfileifthefirstfourbytesofhexreadthewords,namelyCAFEBABE,itwillspellthetwowords"CAFEBABE"(coffeegirl.
October1994,HotJavaandtheJavaplatformforexecutivestodemonstrate.In1994,Java1.0aversionalreadyavailablefordownload,buttheJavaandtheHotJavabrowserwasthefirstpublicreleaseinMarch23,1995SunWorldconductedontheGeneralAssembly.ThescientificguidanceofSunMicrosystemsKyrgyzstandeclaredJohn•coverJavatechnology.ThispublicationisNetscape'sexecutivevicepresidentandMarkAnderson,conductedwiththeamazingrelease,announcedinitsNetscapebrowserincludesJavasupport.January1996,Sun'sJavabusinessgroupsetupspecificallydevelopedtoJavatechnology.Reviewcontributions
April20,2009,oracle(Oracleannouncedtheacquisitionofsun.
In1991,Sun'sJamesGosling.BillJoe,who,forTV,controlhouseholdappliancessuchastoastersinteractiondevelopedaOak(thenameofanoaksoftware,heisthepredecessorofJava.Atthattime,Oakdidnotattractattentionuntil1994,withtherapiddevelopmentofInternetand3W,theyusedthepreparationoftheHotJavabrowser,Java,bySunCEOScottMcNealyhasthesupporttoresearchanddevelopment.Inordertopromoteandlegalreasons,wasrenamedin1995,OakJava.NamedafterthesectionofJava,thereislittleepisodedoes,oneday,Javateammembersaredrinkingcoffee,talkaboutwhatthenewlanguagefromthename,itwasproposedtoJava(JavaisanislandofIndonesiaisrichincoffee,thisproposalwastheapprovalofothermembers,sotouseJavatonamethisnewlanguage.Javaisquicklyrecognizedbytheindustrialsector,manylargecompaniessuchasIBMMicrosoft.DECJavapurchasedtherighttousebytheU.S.

magazinePCMagazinenamedthetoptenoutstandingtechnologyproductsin1995.Fromthenon,begananewchapterinJavaapplications.
Java'sbirthchallengesthetraditionalcomputermodels,computersoftwaredevelopmentandsoftwareindustrieshavehadaprofoundimpact:
(1software4Aobjectivesandrequirementsofthesoftwarecanreachanypersoninanyplaceatanytimeforanyelectronicdevicecanbeapplied.Thissoftwareplatformcanmeeteachotherinoperation,withthescalabilityandreusabilityofthedistributedcomputingmodelcanbeplugandplayneeds.
(2Constructionofthedevelopmentapproachbasedontherise,leadstotheCORBAarchitectureandtheinternationalstandardsoftwareframeworkformulti-applicationsystem.BasedonthisplatformandformedJava.2.NETplatform,thetwomajorfactions,andpromotetheentireITindustry.
(3ofthesoftwareindustryandindustrialenterpriseshavehadaprofoundimpactonsoftwaredevelopmentfromthecentershiftedtoaservicecenter.Intermediateproviders,componentproviders,serversoftwareandconsultingserviceprovidersappear.Businessesmustreinventthemselves,B2Be-commercewilldrivetheneweconomy,markets,givingenterprisesnewvalue,newgrowth,newbusinessopportunities,newmanagement.
(4softwaredevelopmenthasbroughtanewrevolution,emphasisonintegrationwiththird-partycomponents,usingtheplatformofinfrastructureservices,achievingvariousstagesofdevelopmentofimportanttechnologies,attentiontothedevelopmentteam,organizationalandculturalideas,collaboration,creativity,responsibility,Credibilityisthebasicqualityofhumanresources.
Inshort,thecurrentJavatoseetheimportanceoftheinformationage,thefuturewillcontinuetodevelop,Javaapplicationswillbeinamorepromisingfuture.1.1Javalanguagedevelopment1.1.1Javalanguagegeneration
Theearly90soflastcentury,Suncompanies,inasmartdeviceforfutureprogramminglanguage,thelanguageshouldhavesomenewfeatures,inordertoavoidsomedeficienciesofC++.
ThelanguageoriginallynamedOak,GoslingfromtheOfficeofthelanguageoftheoaktreeoutsidethewindow(Oak.Laterintheconflictwhenitcameup,sotothinkofhotcoffeefromthehandsofarichcoffeetotheislandsofIndonesia,theChinesenameofJava,Javalanguagenamehere.
WiththerapiddevelopmentofInternet,Webapplicationisbecomingmorewidespread,Javalanguagehasalsobeendevelopingrapidly.In1994,GoslingJavadeveloperswithareal-timehigh,reliable,safe,interactivefeaturesofthenewWebbrowser,itdoesnotdependonanyhardwareplatformandsoftwareplatform.ThebrowsernameisHotJava,andin1995togetherwiththeJavalanguage,officiallyreleasedtotheindustry,causedagreatsensation,Javaattendantpositionwasreaffirmed.Aftermovingveryquickly.
JavaprogramminglanguageandsyntaxsimilartoC++syntax,semanticsandSmallTalkTMisthesemanticsimilarity.Javaprogramminglanguagecanbeanyconventionalprogramminglanguageusedtocreateapplicationsthatcanbecreated.Javaprogramminglanguage,designedthemainobjectivesare:

provideaneasyprogramminglanguage,therebyeliminatingtheotherlanguagessuchaspointerarithmeticandmemorymanagementoftherobustnessofthedefects.useofobject-orientedconceptstomaketheprogramtrulybecomeafullyobject-orientedprogramming.
Tomakethecodeclearandreasonableaspossible,provideaconciseandsmoothway.
Forthefollowingtwopointsprovideaninterpretationofenvironmentalbenefits:Improvethedevelopmentspeedtoeliminatecompile───Links-load-testcycle;portabilitycodesothattheoperatingsystemruntimeenvironmentforsystem-levelcallstodo.
torunmorethanoneactivethreadoftheprogramprovidesaway.
modulebyallowingthedownloadcodetorunwhentheprogramcanalsochangethedynamicsupportprograms.
Toensurethesafetyofthosewholoadthecodemodulewhichprovidesascreeningmethod.
Well-developedJavacoretechnologyforthesegoalstoprovideaguarantee,includingthefollowingmaintechnologies:JavaVirtualMachine
AutomaticgarbagecollectionSecurityCode
1.1.2Javalanguagedevelopment
Javalanguagedevelopmentgoalsisnotjustaprogramminglanguage,butalsotobuildadevelopmentenvironment,anapplicationenvironment,adeploymentenvironment.AsthemostbasicsupportforJavalanguage,Sunreleasedin1996,JavaDevelopmentKitJDK1.0(JDKistheJavaDevelopKitforshort,includingtheneedforJavadevelopersofvariousutilityprograms(compilation,execution,documentationgenerators,etc.,basicclasslibrary(equivalenttoClanguagelibraryandC++classlibrary,instancesandsoon.In1998,SunhasreleasedanupdatedJDK1.2,becausethethinkingintechnology,manyimprovementswiththeprevious,sothenextJavatechnologyisgenerallyknownasJava2.Subsequently,thecharacteristicsofdifferentareas,Javatechnologyisdividedintothreedifferentplatforms(thelatesttitlehasremovedtheambiguousmeaningof2,suchasJavaSE:
J2SE-JavaPlatformStandard
J2SEisthestandardversionofJavalanguage,referstotheJDK(1.2andlaterversions,includingtheJavaFoundationClassLibraryandgrammar.ItisusedtodeveloprichGUI(graphicaluserinterface,complexlogicandhigh-performancedesktopapplications.J2EE-EnterpriseJavaplatform
BuiltontopofJ2EEJ2SEforthedevelopmentandimplementationofenterpriseapplications.Itisastandardmulti-tierarchitecture,enterpriseapplicationscanbedividedintoclientlayer,presentationlayer,businesslayeranddatalayer,mainlyfordevelopinganddeployingdistributed,component-based,secure,reliable,scalableandeasymanagementofenterprise-classapplications.
J2ME-EmbeddedJavatechnologyplatform
J2MEisbuiltontopofJ2SE,mainlyforthedevelopmentofalimitedconnection,memory,

anduserinterfacecapabilitiesofthedeviceapplication.Suchasmobilephones(mobilephones,PDA(e,toaccesstheset-topboxorcableserviceterminalandotherconsumerelectronicproducts.
Anylanguagetoestablishthetypesofapplicationsaremoreorlessrunningtheapplicationrelatedtotheenvironment,andJavalanguagecancreatethefollowingtwogeneralprocedures:
Applications
Applicationsisastand-aloneprogram,itisatypicalgeneralprocedure,whichcanrunonanyJavaruntimeenvironmentwiththedevice.
Applets
AppletsarestoredinaWWWserverwiththeJavaprogramminglanguageprogram,itisusuallydownloadedbythebrowsertotheclientsystem,andrunthroughabrowser.Appletsareusuallysmalltoreducedownloadtime,whichconsistsoftheHypertextMarkupLanguage(HTMLforWebpagestocall.
Javaruntimeenvironmenthassomespecial,oralotofpeopletoestablishaspecialruntimeenvironment,Javaprogrammingisoftentheestablishmentofvariouscomponents,theycanberuninaspecificenvironment,suchasServlet,JavaBean,JSPandsoon.
IntheJavatechnologysystem,therearemanyfreeorfreethird-partyJavacomponents,theyoftenprovideasolutiontoaparticularaspectcanbeusedinmanyprojectsinthedevelopmentprocess.
LearningneedstoknowtheJavalanguageJavatechnologysystem,startingfromthelocaldetailsofthestudy,carriedoutfromtheoveralldirectionofawarenessandchoice,fromtheapplicationtoconsolidatetoimprove.1.2JavaLanguageFeatures
JavalanguageforInternetenvironment,isawidelyusedwebprogramminglanguage,ithasthefollowingfeatures:
Simple
JavalanguageandC++syntaxrulesaresimilar,butcanceledtheJavalanguageandmultipleinheritancepointer,unifiedbyreferencetoindicatetheobject(C++intwoforms,isactuallytwowaystogenerateobjects,andJava,thereisonlyonebyautomaticgarbagecollectioneliminatestheneedforprogrammersworkingforthereleaseofthememoryblock.
object-oriented(nearlycomplete
Javalanguageinordertoimproveefficiency,definedafewbasicdatatypestoachieveanon-classmanner,andtheremainingclassofalldatatypesintheformofpackaging,theprogramstructureofthesystemunitisalsoaclass.Thereforeconsideredtobealmostcompletelyobject-oriented.
platformindependent(portable,cross-platform
JavaVirtualMachine(JVMistrueinavarietyofmachinearchitecturesimplementedusingsoftwaretosimulateanimaginarymachine,whennecessary,canbeimplementedbyhardware.
Ofcourse,theinternalimplementationofthesevirtualmachinesvary,butitsfunctionisthesame-theimplementationofaunifiedJavavirtualmachineinstructions.

JavacompilerJavaapplication'ssourcecodefiles(.JavatranslatedintoJavabytecodefile(.Class,whichiscomposedofJavavirtualmachineinstructions.Becauseitisavirtualmachine,andthustheimplementationofJavaVirtualMachineJavaprogramscommonlyreferredtoastheprocessofinterpretation.
Reliesonvirtualmachinetechnology,Javalanguagehasnothingtodowiththecharacteristicsofthemachinearchitecture,thatJavaprograms,onceafterbeingwritten,canbetransplantedwithoutmodificationtoanyoneonadifferentmachinearchitecture.Fromtheoperatingsystempointofview,theprocessofimplementationofaJavaprogramistheprocessofimplementationofaJavavirtualmachineprocess.
orientednetworkprogramming
JavalanguageforgeneratingthebeginningofthenetworkofsupportintheJDKincludesTCP/IP,HTTPandFTPprotocolssuchasclasslibraries.
Multi-threadingsupport
Multithreadingistosimultaneouslyperformmultipletasksofafunction.Multi-threadingmechanismthatenablesapplicationstoperformmultipletasksinparallel,thevariousthreadsynchronizationmechanismstoensureproperoperationoftheshareddata.Goodsecuritycode
Runtime(Runtimetermperspectiveemphasizesthedynamicprocessofthedynamicchangeswhentheprogramisrunning,butalsowiththeexpressionoftheruntimeenvironmentsimilartothemeaningoftheword.
Javatechnologyisalotofworkdoneatruntime,suchasstrengtheningsecuritycodeverificationoperations.
Ingeneral,Javatechnologyruntimeenvironmentperformsthefollowingthreemajortasks:loadingcode-theimplementationbytheclassloader
Classloaderfortheimplementationoftheproceduresrequiredtoloadallclasses(asfaraspossibleandnotnecessarilythesame.
validationcode-theimplementationofthebytecodeverifier
Javacodebeforetheactualoperationafterseveraltests.Bytecodeverifierforfourtimesonthevalidationcode,whichcanensurecodecomplianceanddoesnotdestroytheJVMspecificationsystemintegrity.If-Checkforgedpointers,objectaccessrightsviolationorattempttochangetheobjecttypeofillegalcode.
codeexecution-fromtheimplementationoftheruntimeinterpreter
Automaticgarbagecollection
Manyprogramminglanguagesallowprogramsrunninginthememoryblockdynamicallyallocated,theprocessofallocatingmemoryblocksbecauseofthelanguagesyntaxvaries,butalwayspointtothestoretoreturntothestartingpositionofthepointer.InC,C++andotherlanguages,theprogrammerisresponsiblefordeallocationofmemoryblocks.Sometimesthisisaverydifficulttask.Becauseprogrammersdonotalwaysknowinadvancewhenablockofmemoryshouldbereleased.Whennotinthesystemcanbeallocatedmemoryblock,itcancausetheprogramtoastandstill,thisprocedureiscalledamemoryleak.
Whentheallocatedmemoryblockisnolongerneeded,theprogramshouldbecanceledortheoperatingenvironmenttoallocatememoryblock.
garbagecollectionisnolongerneededrecoveryofallocatedmemoryblock.

inotherlanguagesingeneral,istheprogrammer'sresponsibilitytocanceltheallocation.
Javaprogramminglanguageprovidesasystem-levelthreadstokeeptrackofmemoryallocation,tocompletethegarbagecollection:
nolongerneedtocheckandreleasethememoryblocktheaboveworkcanbecompletedautomatically
intheJVMimplementationcycle,resultinginunexpectedchanges
goodrobustnessofthecode
Javaprogramtocheckatcompileandrun-timeerrors.Typeofexaminationcanhelpdetectmanyerrorsearlyindevelopment.Meanwhile,manyintegrateddevelopmenttools(IDEtocompileandruntheemergenceofJavaprogramseasierandalotofintegrateddevelopmenttools(egEclipsearefree.

1.3Object-orientedandprocess-orienteddifferences
Theproductionofaprogramminglanguage,programmingisnotonlyatechnicalimprovement,butalsoincludestheexpressionofideasandcognitiveprogress.TheClanguageastherepresentativeoftheearlypartofthelanguage,knownasprocess-orientedlanguage,notonlybecauseoftheirexpressionofprogramdesignisbasedonthebasicelementsoftheprocess,inessence,isnowmoreunderstandingofthecomputerizedsystemthedominantideologyorcontrolflowordataflow,constituteelementsofthesystemisthemodule-processinglogic.
Thegenerationofobject-orientedlanguages,becausetheunderstandingofthesystemortheabstracttoamoreadvancedlevel.Cognitivethinkingatthistimenotonlyclosertotherealworld,anditshighdegreeofabstraction.Thus,botheasytounderstandontheonehand,therearealsodifficulttounderstandtheotherhand,toseetherealmofunderstanding.
1.3.1Reviewprocess-orientedthinking
Process-orientedprogramminglanguage,thoughtandexpression,canbesimplysummarizedasthefollowingfew:
Understandingofthesystemstructureanalysisoftheprocess-top-down,stepwiserefinementtothefunctionaldecomposition;
Eachfunctionisadataprocessingmodule,whichfullydescribetheIPOdescribedtheinternalandexternalfeaturesofthemodule;
Eachmoduleiscontrolflow,andthereforehaveatypicalstructureofthethreeprocedures-sequence,branch,loop;
Therelationshipbetweenthemodulebycallingthepreserve,whichhasbecomeafunctionmodule,whichisthemostimportantprocess-orientedwayofcodereuseunderway;
Althoughthefunctioncallparametersandreturnvalues,butthedataandfunctionsarealwaysseparate,notonlywiththefamousassertion-program=algorithm+data,butalsomakestheabsoluteequalityofthedisorderhavetrouble-allthefunctionsanddatarelationshipisnolimit;
Ifyouwanttousethedataflow,thenthedatacanonlybeproducedinanappropriatetimeafterthecallfunction.

Themaindrawbackofthisperiodare:understandingthesystemmoredifficult,thesystematicdevelopmentoflowefficiency,codereusabilityispoor.Introduction1.3.2OOP
Object-orientedthinkingontheuseofanintuitiveunderstandingoftherealworld,whentheuseofcomputerizeddepthofabstractioncanbesummarizedbrieflyasfollows:Systemiscomposedofthings,thereisaconnectionbetweenthings,thecomplexityissystem;
Systemandthesystem,andthings,thingsandthingsisaclearboundarybetweenthe(boundaryof;
Systemorthestateofthingscandescribetheproperty,saidpropertyisusuallysomesimpledata,ifthatissomethingthecomplex;
Systemorthestateofthingswillchange,calledthebehaviorofadifferencethereisareason(internalorexternal,changesintheprocessmaybecomplex;
Willhavedifferentthingsincommonbetweenthepropertiesandbehavior,acommonextremecaseiscompletelycontained.
Basedontheaboveunderstanding,aruntime(dynamictothespecificsystemorsomething,byseveralsmallerthingsthatconstituteaspecific(extremethingsisasimpleattributedata,whichisconstantlychanging.Ifthisconceptofthingsaneffectiveabstract,thentheproblemissolved.
Firstofall,anyonespecificthingcalledtheobject(Object,itistheextremecaseofpreviousvariables;thingsareclassified,eachclassofthingshavethepropertiesandbehaviorofuniform,thattype-abstractdatatypes,referredtoasfortheclass(Class;behaviorsinceitistheprocess,thenafunctionoftheabstract,namedforthemethodtoshowthedifference.Forexample:
Describetheheightorname,eachjustasimpledatavariable;
Describeastudent,youcanusethestudentnumber,name,dorm,class,etc.;Whatkindofaccommodationthatreplacedit!
Itdescribesthedorm,class,andalsohasmanyprojects.
1.4Object-orientedprogrammingconceptsandfeaturesofthemain
Object-orientedprogramming(ObjectOrientedProgramming,OOPlanguage,inordertobemorehighlyabstract,willintroducesomeoftherealworld,theconceptisdifficulttofind,butforaprogramminglanguageisindeedvaluable.Thefollowingdescribestheconceptofbeingbasicallyderivedfromtheabstracttotherealworld,fromtheroleofprogramdesigntounderstandthem.
Object-orientedprogrammingtomakethesystemeasiertounderstand,butalsomakethecodebetterreusability,scalability,easymanagementandmaintenance.1.4.1MainConcepts
1,class
Classistheabstractofaclassofthingsthatthedatatypeisequivalenttoitsrole,ofcourse,canberegardedascomplexdatatypes.Suchasstudents,dormitories,class.2,theobject
Objectrepresentsaspecificthing,itsroleisvariable,thatis,acomplexdatatype-xx

classvariables.SuchasZhouYu,ZhangFei,Yuflyhome,Tigerclasses.
3members
Theelementsofathingtodiscusswhentheclassisvirtual,itisthediscussionofspecificobjects.Asinclass,avariablebelongingtomembers-membervariable,anobjectalsobelongtomembers-membersoftheobject,afunctionalsobelongtothemembers-membersofthemethod.1.4.2MainFeatures
TherearethreefeaturesofOOPlanguages:encapsulation,inheritanceandpolymorphism.1package
Thecompositionincludesmembersoftheclassvariables/objectsandmembersofthemethod,sotherelevantdataandfunctionswillbepackagedtogetherwithotherdistinguishedclassispackage.Obviously,avoidingtheprocess-orientedparallellanguagedefects,indicatingtheclassandmembersoftheirrespectiverelationships.Further,membersoftheclasscanlimitthevisibilityoftheexternal,thenthepackagewillreflectthemoreperfect.
2,inheritance
WhenathingisanotherthingentirelyaspecialcaseofB,then,ingeneral,theclassAclassBismorethanthenumberofmembervariables/objectsandmembersofthemethod,calledclassAinheritsclassBandclassAiscalled(ClassB'ssub-class,classBiscalled(ClassAfortheparentclass.
Parent,alsoknownasthebaseclass,superclass,subclass,alsoknownasderivedclass,derivedclass.
ObviouslythereisnoneedtowriteduplicatesubclasstheparentclasstowritesomecodeinPartB,whichisthemosttypicalOOPcodereuse.
3,multi-state
Polymorphismthatanactofaclassthereareseveralimplementationversion.Thesimplestcaseisinaclass,givenavarietyofdifferentimplementations,thecomplexisinmanydifferentsub-classesaregivenintheirimplementation.*1.5JavaandC++Differences1.6ChapterSummaryExercise
1.Javalanguagetoexplainthethreeplatforms.
2.SupporttheJavalanguagetoexplainthethreemaintechnicalgoals(checkinganddataintegrity.
3.Object-orientedandprocess-orienteddifferentfromtheproblemsandissuesthatbothunderstandthepointofview,inaccordancewiththeindividual'sunderstandingandawarenessof,forexample,showthedifferentplaces


本文来源:https://www.2haoxitong.net/k/doc/4253262f0722192e4536f648.html

《Java语言概述与面向对象思想--中英文翻译.doc》
将本文的Word文档下载到电脑,方便收藏和打印
推荐度:
点击下载文档

文档为doc格式