Home > Java > javaTutorial > body text

Ask the expert - New Operator

王林
Release: 2024-07-31 10:30:41
Original
383 people have browsed it

Pergunte ao especialista - Operador New

Why don't I need to use new for variables with primitive types, such as int or float?

Answer:
The primitive types of the Java language are not implemented as objects. Instead, due to efficiency concerns, they are implemented as “common” variables. A primitive type variable contains the value we give it.
As explained, object variables are references to the object. This layer of indirect addressing (and other features of objects) adds overhead to an object that is avoided by a primitive type.

The above is the detailed content of Ask the expert - New Operator. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!