第一章介绍:Chapter1-Introduction

     The Java TM programming language is a general-purpose,concurrent,class-based,object-oriented language.It is designed to be simple enough that many programmers can achieve fluency in the language.The Java programming language is related to C and C++ but is organized rather differently,with a number of aspects of C and C++ omitted and a few ideas from other languages included.It is intended to be a production language,not a research language,and so,as C.A.R.Hoare suggested in his classic paper on language design,the design has avoided including new and untested features.

  总结一下子:Java编程语言是一种用于通用目的的,支持并行的,基于类的,面向于对象的语言。 设计Java的目的在于让更多使用它的程序员能够更加熟练地去完成设计和开发工作。Java语言和C,C++语言相互关系着,但是是以一种完全不同的方式在组织着。它忽略了C与C++中的好多特性,同时又吸收了一些其他语言的一些优秀的设计思想。Java一直致力于成为一种产品型高效的语言,而不是一种科研性的研究型语言,因此,就像xxx在他的那篇关于语言设计的经典论文中谈到的那样子,Java语言的设计就严格遵守了这个原则:应该避免在语言中引入新鲜的不成熟而没有经过测试的功能,那将会糟糕的,因为稳定性很重要的。(恩。是的。重视本质呀。)

      The Java programming language is strongly and statically typed.This specification clearly distinguished between the compile-time errors that can and must be detected at compile time,and those that occur at run-time.Compile time normally consists of translating programs into a machine-independent byte code representation.Run-time activities include loading and linking of the classes needed to execute a program ,optional machine co

de generation and dynamic optimization of the program ,and actual program execution.

   总结一下子:Java是强类型,静态类型的编程语言。此文档就非常清晰地区分了在编译时候能够而且必须检测到的“编译时错误”与那些在运行时发生的“运行时错误”之间的差别。“编译时”通常的活动内容就是把程序翻译成独立于机器的字节码形式。”运行时“活动就包含了加载和链接执行程序所必须的类,可选的机器码自动生成,程序的动态优化,以及程序的实际执行啦。

    The Java programming language is a relatively high-level language,in that details of the machine representation are not available through the language.It includes automatic storage management,typically using a garbage collector,to avoid the safety problems of explicit deallocation(as in C's free or C++'s delete).High-performance garbage-collected implementations can have bounded pauses to support systems programming and real-time applications.The language does not include any unsafe constructs,such as array accesses without index checking,since such unsafe constructs would cause a program to behave in an unspecified way.

   总结一下子:Java编程语言是一种相对比较高级的语言,(?但是在机器代表形式上的细节是不可以操作的)。它包括了自动存储管理,特别表现在使用了一种垃圾收集器来避免明确销毁操作上可能引发的安全性问题(就像C中的free,C++中的delete销毁操作了)。高性能的垃圾收集实际方案有界的pauses去支持系统编程和实时程序……(?)。Java语言不包含任何不安全的构造,比如无索引检查的数组访问,因为像这样子的不安全构造会导致程序以未知的方式去运行。

 The Java programming language is normally compiled to the bytecoded instruction set and binary format defined in The Java TM Virtual Machine Specification,Java SE 7 Edition.

  总结一下子:Java编程语言正常情况下是被编译成字节码指令集和二进制形式的。你可以在Java SE7的JVMS当中参考呀。 

      1.1 Organization of the Specification

    Chapter 2 describes grammars and the notation used to present the lexical and syntactic grammars for the language.

  总结一下子:第二章节描述了Java语言中所采用的展示词法和句法的,语法结构和表示法(注释)。

    Chapter 3 describes the lexical structure of the Java programming language,which is based on C and C++.The language is written in the Unicode character set.It supports the writing of Unicode characters on systems that support only ASCII.

  总结一下子:第三章节,详细描述了Java语言的词法结构,当然,这个是基于C和C++的。如果你学习过它们的话,你能够看得出来呀。Java语言是采用Unicode字符集来编写的。所以,即使在只支持ASCII码制的机器上,它也支持Unicode字符的应用编写。 

    Chapter 4 describes types,values,and variables.Types are subdivided into primitive types and reference types.

  总结一下子:第四章节描述了类型,数值,以及变量。类型又被细分为原生(基本)类型和引用类型。  

    The primitive types are defined to be the same  on all machines and in all implementations,and are various sizes of two's-complement integers,single- and double-precision IEEE 754 standard floating-point numbers,a boolean type,and a Unicode character char type.Values of the primitive types do not share state.

  总结一下子:原生类型在所有的机器上定义都是相同的。原生类型的数值不共享state。(?本段的翻译不是很好理解) 

    Reference types are the class types,the interface types,and the array types.The reference types are implemented by dynamically created objects that are either instances of classes or arrays.Many references to each object can exist.All objects (including arrays) support the methods of the class Object,which is the (Single) root of the class hierarchy.A predefined String class supports Unicode character strings.Classes exist for wrapping primitive values inside of objects.In may cases,wrapping and unwrapping is performed automatically by the compiler(in which case,wrapping is called boxing ,and unwrapping is called unboxing).Class and interface declarations may be generic,that is ,they may be parameterized by other reference types.Such declarations may then be invoked with specific type arguments.

  总结一下子: Java中的引用类型指类类型,接口类型,以及数组类型。而且明白,引用类型的内部实现机制是通过动态创建类或者数组的实例对象方式来实现的。针对于每个对象的许多引用可以同时存在。所有的对象(包括数组)都支持Object类的方法,因为Object类是java类关系级别当中唯一的最顶层类啦。预定义的String类支持Unicode字符编码的字符串。类存在的意义在于将原生数据值封装在对象内部。而在许多情境中,封装和反封装都是编译器自动执行操作的(这种情景下,就把封装叫做自动装箱,而把反封装叫做自动拆箱。)类以及接口的声明可能是普通的,这意味着,他们可以被其他引用类型参数化。这样的声明可能之后就被指定的类型参数进行调用啦。 

    Variables are typed storage locations.A variable of a primitive type holds a value of that exact primitive type.A variable of a class type can hold a null reference or a reference to an object whose type is that class type or any subclass of that class type.A variable of an interface type can hold a null reference or a reference to an instance of any class that implements the interface.A variable of class type Object can hold a null reference or a reference to an array .A variable of class type Object can hold a null reference or a reference to any object,whether class instance or array.

  总结一下子: 变量的本质是类型化的存储位置。(?突然想起,C++中对存储位置的解释啦。是啥?忘了,得再查阅一番。)一个原生数据类型的(基本数据类型)变量存放的是原生数据类型精确对应的某个具体的值。一个类类型的变量可以存放的是null引用或者是该类类型的实例对象或者是该类的子类(派生类)类型的实例变量。一个接口类型的变量存放的是null引用或者是实现该接口的任何类的实例对象。一个Object类的变量可以存放null空对象或者是存放一个数组。一个Object类类型的变量可以存放null空对象或者是存放任何对象,类实例也好,数组也好。 

   Chapter 5 describes conversions and numeric promotions.Conversions change the compile-time type and ,sometimes,the value  of an expression.These conversions include the boxing and unboxing conversions between primitive types and reference types.Numeric promotions are used to convert the operands of a numeric operator to a common type where an operation can be performed.There are no loopholes in the language;casts on reference types are checked at run-time to ensure type safety.

  总结一下子:第五章节描述了转换和数值promotions。转换改变了编译时的类型,有的时候是改变了表达式的类型。这些转换包括介于原生数据类型和引用数据类型之间开展的自动装箱和自动拆箱转换。数值promotions(是强制类型转换吗,还是自动类型转换)用于将数值操作符的操作数转换成一种通用的类型以保证一个正常的操作运算可以执行。语言这里没有漏洞(?);针对于引用类型的强制转换在运行时要被检查以保证类型安全性。

    Chapter 6 describes declarations and names ,and how to determine what names mean(denote).The language does not require types or their members to be declared before they are used.Declaration order is significant only for local variables,local classes,and the order of initializers of fields in a class or interface.

  总结一下子:第六章节描述了声明,名字,以及如何决定名字意味着什么(象征)。 Java不要求你的类或者是其成员在使用之前必须先声明。声明顺序只对于局部变量,局部类,类或者接口当中的初始化操作者的顺序有重大意义。(?)

     The Java programming langauge provides control over the scope of names and supports limitations on external access to members of packages,classes,and interfaces.This helps in writing large programs by distinguishing the implementation of a type from its users and those who extend it.Recommended naming conventions that make for more readable programs are described here.

  总结一下子: Java语言提供名字的作用域的控制,同时也支持外部对于包内部,或类内部,或接口内部的成员访问的限制。这个有益于编写比较大的程序,

     Chapter 7 describes the structure of a program,which is organized into packages similar to the modules of Modula.The members of a package are classes ,interfaces,and subpackages.Packages are divided into compilation units.Compilation units contain type declarations and can import types from other packages to give them short names.Packages have names in a hierarchical name space,and the Internaet domain name system can usually be used to form unique package names.

  总结一下子:第七章节描述了一个程序的结构,程序通过组织成类似于模块的包来管理的。一个包的成员可以是类,接口,和子包。包被划分为编译单元。编译单元包含了类型声明,而且可以通过import从其它包中导入类型来给它们一些简短的名字。

     Chapter 8 describes classes. The members of classes are classes ,interfaces,fields(variables)and methods.Class variables exist once per class.Class methods operate without reference to a specific object.Instance variables are dynamically created in objects that are instances of classes.Instance methods are invoked on instances of classes;such instances become the current object this during their execution,supporting the object-oriented programming style.

     Classes support single implementation inheritance ,in which the implementation of each class is derived from that of a single superclass,and ultimately from the class Object.Variables of a class type can reference an instance of that class or of any subclass of that class,allowing new types to be uesd with existing methods,polymorphically.

     

     Classes support concurrent programming with synchronized methods.Methods declare the checked exceptions that can arise from their execution,which allows compile-time checking to ensure that exceptional conditions are handled.Objects can declare a finalize method that will be invoked before the objects are discarded by the garbage collector ,allowing the objects to clean up their state.

    For simplicity,the language has neither declaration "headers" separate from the implementation of a class nor separate type and class hierarchies.

 

    A special form of classes,enums,support the definition of small sets of values and their manipulation in a type safe manner.Unlike enumerations in other languages,enums are objects and may have their own methods.

    Chapter 9 describes interface types,which declare a set of abstract methods,member types,and constants.Classes that are otherwise unrelated can implement the same interface type.A variable of an interface type can contain a reference to any object that implements the interface.Multiple interface inheritance is supported.

    Annotation types are specialized interfaces used to annotate declarations.Such annotations are not permitted to affect the semantics of programs in the Java programming language in any way.However,they provide useful input to various tools.

    Chapter 10 describes arrays.Array accesses include bounds checking.Arrays are dynamically created objects and may be assigned to variables of type Obejct.The language supports arrays of arrays,rather than multidimensional arrays.

    Chapter 11 describes exceptions,which are nonresuming and fully integrated with the language semantics and  concurrency mechanisms.There are three kinds of exceptions:checked exceptions,run-time exceptions,and errors.The compiler ensures that checked exceptions are properly handled by requiring that a method  or constructor can result in a checked exception only if the method or constructor declares it.This provides compile-time checking that exception handlers exist,and aids programming in the large.Most user-defined exceptions should be checked exceptions.Invalid operations in the program detected by the Java virtual machine result in run-time exceptions,such as NullPointerException.Errors result from failures detected by the Java virtual machien,such as OutOfMemoryError.Most simple programs do not try to handle errors.

 

      Chapter 12 describes activities that occur during execution of a program.A program is normally stored as binary files representing compiled classes and interfaces.These binary files can be loaded into a Java virtual machine,linked to other classes and interfaces,and initialized.

    After initialization,class methods and class variables may be used.Some classes may be instantiated to create new objects of the class type.Objects that are class instances also contain an instance of each superclass of the class,and object creation involves recursive creation of these superclass instances.

 

    When an object is no longer referenced,it may be reclaimed by the garbage collector.If an object declares a finalizer,the finalizer is executed before the object is reclaimed to give the object a last chance to clean up resources that would not otherwise be released.When a class is no longer needed,it may be unloaded.

 

    Chapter 13 describes binary compatibility,specifying the impact of changes to types on other typs that use the changed types but have not been recompiled.These considerations are of interest to developers of types that are to be widely distributed,in a continuing series of versions,often through the Internet.Good program development environments automatically recompile dependent code whenever a type is changed,so most programmers need not be cncerned about these details.

 

Chapter 14 describes  blocks and statements,which are based on C and C++.The language has no goto statement,but includes labeled break and continue statements. Unlike C,the Java programming language requires boolean (or Boolean) expressions in control-flow statements,and does not convert types to boolean implicitly(except through unboxing),in the hope of catching more errors at compile time.A synchronized statement provides basic object-level monitor locking.A try statement can include catch and finally clauses to protect against non-local control transfers.

  

 Chapter 15 describes expressions.This document fully specifies the (apparent) orde of evaluation of expressions,for increased determinism and portability.Overloaded methods and constructors are resolved at compile time by picking the most specific method or constructor from those which are applicable.

 

 Chapter 16 describes the precise way  in which the language ensures that local variables are definitely set before use.While all other variables are automatically initialized to a default value,the Java programming language does not automatically initialize local variables in order to avoid masking programming errors.

 

Chapter 17 describes the semantics of threads and locks,which are based on the monitor-based concurrency originally introduced with the Mesa programming language.The Java programming language specifies a memory model for shared-memory multiprocessors that supports high-performance implementations.

 

Chapter 18 presents a syntactic grammar for the language.

 

1.2 Example Programs

 

Most of the example programs given in the text are ready to be executed and are similar  in form to :

 Class Test{

  public static void main(String args[]){

        for (int i =0;  i <args.length; i++)

             System.out.println(i == 0 ? args[i] :" "+ args[i]);

            System.out.println();

     }
}

    

On a machine with the Reference Implementation of a compiler for the  Java programming language installed,this class ,stored in the file Test.java ,can be compiled and executed by giving the commands:

   javac Test.java

   java Test  Hello,world.

producing the output:

   Hello,world.

 

1.3 Notation

       Throughout this specification we refer to classes and interfaces drawn from the Java SE platform API.Whenever we refer to a class or interface which is not defined in an example in this specification using a single identifier N,the intended reference is to the class or interface named N in the package java.lang.We use the canonical name($$6.7)for classes or interfaces from packages other than java.lang.

 

      Whenever we refer to The Java TM Virutal Machine Specification in this specification,we mean the Java SE 7 Edition.

      Discussion and non-normative information is given in smaller,intended text.

       This is discussion.It contains no normative information.

 

1.4 Relationship to Predefined Classes and Interfaces

    As noted above,this specification often refers to classes of the Java SE platform API.In particular,some classes have a special relationship with the Java programming language.Examples include  classes such as Object,Class,ClassLoader,String,Thread,and the classes and interfaces in package java.lang.reflect,among others.This specification constrains the behaviour of such classes and interfaces,but does not provide a complete specification for them.The reader is referred to the Java SE platform API documentation.

 

Consequently,this specification does not describe reflection in any detail.Many linguistic constructs have analogs in the reflection API,but these are generally not discussed here.So,for example,when we list the ways in which an object can be created,we generally do not include the ways in which the reflective API can accomplish this.Readers should be aware of these additional mechanisms even though they are not mentioned in this text.

 

1.5 References

     Common Lisp Object System Specification

     The Annotated C++ Reference Manual

     Smaltalk-80:The Language.

     Hints on Programming Language Design.

     Standard for Binary Floating-Point Arithmetic.

     The C Programming Language,2nd ed.

     Object-Oriented Programming in the Beta Programming Language.

     The Mesa Programming Language,Version 5.0.

     The C++ Programming Language,2nd ed.

     The Unicode Standard,Version 6.0.0.

 

   

 

 

     

 

 

 

 

 

 

 

 

 

 

 

 

 

posted on 2011-11-18 08:57  评评 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/yxcb/archive/2011/11/18/2253465.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值