1. Check whether the class is loaded.
When the virtual machine encounters the new instruction, it first checks whether the parameters of the instruction can be located as a symbol reference of a category in the constant pool, and checks whether the category represented by the symbol reference is loaded, analyzed and initialized. . Otherwise, perform the class loading process.
2. Allocate memory for the target.
After completing class loading, the virtual machine begins to allocate memory to the target and determines the required memory size. Just allocate the necessary memory on the heap.
3. Initialize the allocated storage space with a zero value.
After the memory allocation of the object is completed, the memory space of the object needs to be initialized to zero to ensure that the object can be used directly even if it has no initial value.
4. Make other settings for the audience.
After allocating memory space and initializing the zero value, the virtual machine also needs to make other necessary settings for the object. The setting place is located in the object header, including the class to which the object belongs, class metadata information, and object hashcode. , GC agent age and other information.
5. Execute the init method.
After performing the above steps, even if the object in the virtual machine is successful, the Java program still needs to implement the init method, because the object at this time is only an initialized zero value, and there is no real initialization based on the code in the program. value, so after calling the init method, this object can really be used.
What are the commonly used java frameworks
1. SpringMVC, Spring Web MVC is a lightweight Web framework based on Java that implements the request-driven type of Web MVC design pattern.
2.Shiro, Apache Shiro is a security framework for Java.
3.Mybatis, MyBatis is an excellent persistence layer framework that supports ordinary SQL queries, stored procedures and advanced mapping.
4.Dubbo, Dubbo is a distributed service framework.
5.Maven, Maven is a project management and build automation tool.
6.RabbitMQ, RabbitMQ is a high-concurrency and high-reliability AMQP message queue server implemented in Erlang. 7.Ehcache, EhCache is a pure Java in-process caching framework.
The above is the detailed content of How to create objects in java. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于结构化数据处理开源库SPL的相关问题,下面就一起来看一下java下理想的结构化数据处理类库,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于PriorityQueue优先级队列的相关知识,Java集合框架中提供了PriorityQueue和PriorityBlockingQueue两种类型的优先级队列,PriorityQueue是线程不安全的,PriorityBlockingQueue是线程安全的,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于java锁的相关问题,包括了独占锁、悲观锁、乐观锁、共享锁等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于多线程的相关问题,包括了线程安装、线程加锁与线程不安全的原因、线程安全的标准类等等内容,希望对大家有帮助。

本篇文章给大家带来了关于Java的相关知识,其中主要介绍了关于关键字中this和super的相关问题,以及他们的一些区别,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于枚举的相关问题,包括了枚举的基本操作、集合类对枚举的支持等等内容,下面一起来看一下,希望对大家有帮助。

封装是一种信息隐藏技术,是指一种将抽象性函式接口的实现细节部分包装、隐藏起来的方法;封装可以被认为是一个保护屏障,防止指定类的代码和数据被外部类定义的代码随机访问。封装可以通过关键字private,protected和public实现。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于设计模式的相关问题,主要将装饰器模式的相关内容,指在不改变现有对象结构的情况下,动态地给该对象增加一些职责的模式,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
