linux工作进程状态显示---------top命令
2014-03-24 13:21
706 查看
java 对象的创建过程在thinking in java 中原话:
1. Even though it doesn’t explicitly use the static keyword, the constructor is actually a
static method. So the first time an object of type Dog is created, or the first time a
static method or static field of class Dog is accessed, the Java interpreter must
locate Dog.class, which it does by searching through the classpath.
2. As Dog.class is loaded (creating a Class object, which you’ll learn about later), all of
its static initializers are run. Thus, static initialization takes place only once, as the
Class object is loaded for the first time.
3. When you create a new Dog( ), the construction process for a Dog object first
allocates enough storage for a Dog object on the heap.
4. This storage is wiped to zero, automatically setting all the primitives in that Dog
object to their default values (zero for numbers and the equivalent for boolean and
char) and the references to null.
5. Any initializations that occur at the point of field definition are executed.
6. Constructors are executed. As you shall see in the Reusing Classes chapter, this might
actually involve a fair amount of activity, especially when inheritance is involved.
附件为实例代码,从实例代码可以很清晰地看出对象的初始化过程。
1. Even though it doesn’t explicitly use the static keyword, the constructor is actually a
static method. So the first time an object of type Dog is created, or the first time a
static method or static field of class Dog is accessed, the Java interpreter must
locate Dog.class, which it does by searching through the classpath.
2. As Dog.class is loaded (creating a Class object, which you’ll learn about later), all of
its static initializers are run. Thus, static initialization takes place only once, as the
Class object is loaded for the first time.
3. When you create a new Dog( ), the construction process for a Dog object first
allocates enough storage for a Dog object on the heap.
4. This storage is wiped to zero, automatically setting all the primitives in that Dog
object to their default values (zero for numbers and the equivalent for boolean and
char) and the references to null.
5. Any initializations that occur at the point of field definition are executed.
6. Constructors are executed. As you shall see in the Reusing Classes chapter, this might
actually involve a fair amount of activity, especially when inheritance is involved.
附件为实例代码,从实例代码可以很清晰地看出对象的初始化过程。
相关文章推荐
- CentOS 6.5 yum安装配置lnmp服务器
- CentOS yum有时出现“Could not retrieve mirrorlist ”的解决办法——resolv.conf的配置
- Centos系统搭建LAMP
- linux之sed用法
- 正则表达式 LINUX
- linux正则表达式基础
- linux正则表达式基础
- 正则表达式 LINUX
- linux之sed用法
- 如何更改linux文件的拥有者及用户…
- Linux下安装JDK和Eclipse
- Linux下安装JDK和Eclipse
- 如何更改linux文件的拥有者及用户…
- Linux 下安装配置 JDK7(2)
- Linux解压命令
- Linux系统下如何设置IP地址?
- linux ip地址自动获取,ip地址…
- linux命令配置IP详解
- 虚拟机中的Linux安装VMware Tools
- Linux如何自动获取IP地址