TR-Java-lecture01(JAVA语言介绍).ppt_第1页
TR-Java-lecture01(JAVA语言介绍).ppt_第2页
TR-Java-lecture01(JAVA语言介绍).ppt_第3页
TR-Java-lecture01(JAVA语言介绍).ppt_第4页
TR-Java-lecture01(JAVA语言介绍).ppt_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

JavaJava程序设计程序设计 Java Programming Spring, 2009 1成都信息工程学院成都信息工程学院 计算机系计算机系 Course Information nInstructor: lName: Tang, Rong(汤蓉) lTel:lE-mail: lMy Webpage: 教师主页 汤蓉 /Js/PFP/S7L/Default.htm 2 2 Department of Computer Science lLab:12 学时; lExperiment:6学时. 先修课程包括:数据结构、面向对象程序设计等 3 3 Department of Computer Science lFriday, Section 5 and do not leave your PC unattended while you are logged in any time it instead contains bytecodes the machine language of the Java Virtual Machine (JVM). lThe Java launcher tool then runs your application with an instance of the Java Virtual Machine. 2323 Department of Computer Science & TechnologyDepartment of Computer Science & Technology Java Virtual Machine (JVM) nan abstract computing machine nuses software to simulate a real computer nLike a real computing machine, it has an instruction set and manipulates various memory areas at run time ninterprets Java byte code into machine code Write Once, Run Anywhere! 2424 Department of Computer Science & TechnologyDepartment of Computer Science & Technology What is the JVM nA software simulation of a hypothetical computing machine that runs Java bytecodes (Java compiler output). nThe Java Virtual Machine allows Java code to be portable between various hardware and OS platforms. nJava虚拟机(JVM)- Java Virtual Machine,它是通过在实 际的计算机上用软件模拟各种计算机功能模块虚构出来的 一个计算机。Java虚拟机由5个部分组成:一组指令集、一 组寄存器、一个堆栈、一个无用垃圾内存单元收集器和一 个方法区域。 2525 Department of Computer Science & TechnologyDepartment of Computer Science & Technology The Java Virtual Machine 2626 Department of Computer Science & TechnologyDepartment of Computer Science & Technology JAVA 虚拟机 - JVM n为什么使用Java虚拟机? Java语言最重要的特点就是可以在任何操作系统中运行 - 跨平台特性。 Java编译器生成与平台无关的字节码,作为虚拟机的输入,Java解释器得 到字节码后,对其进行解释,使之能在不同的平台下运行。 不同的操作系统有不同的虚拟机。 nJava虚拟机的基本原理 Java虚拟机屏蔽了与具体操作系统平台相关的信息,使得Java语言 编译程序只需生成在Java虚拟机上运行的目标代码(字节码),就 可以在多种平台上不加修改地运行。 Java虚拟机在执行字节码时,实际上最终还是把字节码解释成具体 平台上的机器指令执行。 2727 Department of Computer Science & TechnologyDepartment of Computer Science & Technology Translation of Java to machine code 2828 Department of Computer Science & TechnologyDepartment of Computer Science & Technology Translation of Java to machine code nA two step process Step 1: Compile source code to Java byte code. lByte code is a standard intermediate-level language. lInput: Java code in one or more files ending in .java lOutput: Byte code in one or more files ending in .class Step 2: Interpret Java byte code on a particular machine lThe interpreter converts each byte code statement to the specific type of machine code and then runs that machine code. 2929 Department of Computer Science & TechnologyDepartment of Computer Science & Technology Some Features of Java nPortable/platform independent nThe Java Virtual Machine nAutomatic Garbage Collection nNo pointers or pointer arithmetic nMultiple inheritance replaced by interfaces, eliminates complexities of multiple inheritance 3030 Department of Computer Science & TechnologyDepartment of Computer Science & Technology 可移植性-Portable/platform independent n程序的可移植性:指程序不经过修改而在不同的硬 件或软件平台上运行的特性。 n可移植性包括二个层次:源代码级和二进制级的可 移植性。 C、C+仅有一定的源代码级的可移植性。 Java编译器生成与平台无关的字节码,只要安装了Java 运行系统,其程序就可以在任意的处理器上运行 3131 Department of Computer Science & TechnologyDepartment of Computer Science & Technology Types of Java Programs nApplication Standalone Java program that can run independent of any Web browser nApplet Java program that runs within a Java-enabled Web browser nServlet Java software

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论