`

The Java® Language Specification

    博客分类:
  • JAVA
 
阅读更多
12.Execution:

The Java Virtual Machine starts execution by invoking the method main of some
specified class, passing it a single argument, which is an array of strings


1 Load the Class.

The loading process is implemented by the class ClassLoader and its subclasses.
Different subclasses of ClassLoader may implement different loading policies. In
particular, a class loader may cache binary representations of classes and interfaces,
prefetch them based on expected usage, or load a group of related classes together.


If an error occurs during class loading, then an instance of one of the following
subclasses of class LinkageError will be thrown at any point in the program that
(directly or indirectly) uses the type:
• ClassCircularityError: A class or interface could not be loaded because it
would be its own superclass or superinterface (§8.1.4, §9.1.3, §13.4.4).
• ClassFormatError: The binary data that purports to specify a requested
compiled class or interface is malformed.
• NoClassDefFoundError: No definition for a requested class or interface could
be found by the relevant class loader.
12.3 Linking of Classes and Interfaces EXECUTION
320
Because loading involves the allocation of new data structures, it may fail with an
OutOfMemoryError.
2.Link Test: Verify, Prepare, (Optionally) Resolve
Verification checks that the loaded representation of Test is well-formed, with a
proper symbol table.


Preparation involves allocation of static storage and any data structures that are
used internally by the implementation of the Java Virtual Machine, such as method
tables.http://en.wikipedia.org/wiki/Symbol_table

Preparation involves creating the static fields (class variables and constants) for a class or interface and initializing such fields to the default values

does not require the execution of any source code; explicit initializers for static fields are executed as part of initialization (§12.4), not preparation.



Resolution is the process of checking symbolic references with other
classes and interfaces, by loading the other classes and interfaces that are mentioned
and checking that the references are correct.

errors in Resolution step: IncompatibleClassChangeError,IllegalAccessError,InstantiationError,NoSuchFieldError,NoSuchMethodError, UnsatisfiedLinkError.


3. Initialization of Classes and Interfaces
Initialization consists of execution of any class variable initializers and static
initializers of the class

4.Creation of New Class Instances


分享到:
评论

相关推荐

    The Java® Language Specification Java SE 7 Edition chm 版本

    《Java®语言规范》是Java开发者的权威指南,它详细定义了Java编程语言的各个方面,为Java SE 7版提供了一套完整的规范。这个chm(Compiled HTML Help)版本使得开发者能够更便捷地查阅和理解Java语言的核心概念、...

    The Java® Language Specification Java SE 12 Edition

    《Java®语言规范Java SE 12版》是Java编程语言的官方文档,详细阐述了Java SE平台版本12的编程语言的语法、结构和含义。本规范不仅为Java开发者提供了参考,也为实现Java虚拟机和编写其他语言的编译器提供了重要的...

    Java编程规范 The Java Language Specification Java SE 9

    《Java® Language Specification》是Java编程语言的标准文档之一,它为开发者提供了详细的规范指南,帮助理解和实现Java语言的各种特性。Java SE 9版本作为Java语言发展的一个重要里程碑,引入了许多新特性和改进,...

    java specification

    Java技术规范(TheJava®Language Specification)是Java编程语言的官方文档,它详细描述了Java语言的语法、语义、类型系统、结构等各个方面,确保Java程序的可移植性、安全性和一致性。Java SE 8版是该技术规范的第...

    自学java看什么书-强力推荐15本必看书籍-华清远见.docx

    4. **《Java核心技术卷》(The Java® Language Specification)**:由Java的创造者编写,这本书是Java编程语言的官方技术指南。对于深入理解语言的语法和机制,没有比这更好的资源了。从基础语法到高级特性,它都能...

    java-jls8.pdf

    《Java® Language Specification JavaSE8 Edition》是一份全面描述Java语言规范的官方文档,针对Java SE 8版本进行了详细说明。在深入探讨Java 8的语法和词法基础的同时,文档还介绍了各种语法表示,以及它们在Java...

    jdk-9.0.1_doc-all 最新版

    Java® Platform, Standard Edition & Java Development Kit Version 9 API Specification This document is divided into three sections: Java SE The Java Platform, Standard Edition (Java SE) APIs define...

    Java SE7 语言规范手册

    这份文档是JSR-000901Java® Language Specification的第七版,即Java SE7版。 **版权信息** 文档最后更新于2013年2月28日,于2011年7月发布,拥有美国Oracle公司及其关联公司的版权。Oracle和Java都是Oracle公司...

Global site tag (gtag.js) - Google Analytics