Understanding how to create and manipulate objects from the ground up in java-1.8 (2)

Source: Internet
Author: User

Understanding how to create and manipulate objects from the ground up in java-1.8 (2)

Next, let's continue with the topic about object creation and operation.

(2) Basic type creation and operation

As mentioned in the above storage, the new object is usually placed in the heap, and the direct relationship between the object and the variable is placed in the stack. In fact, there are other things in the stack, that is, the value stored by the basic type, this makes the operation faster.

Below are some basic types of information:


 

Simple Type

Boolean

Byte

Char

Short

Int

Long

Float

Double

Void

Binary digits

1

8

16

16

32

64

32

64

--

Package class

Boolean

Byte

Character

Short

Integer

Long

Float

Double

Void

The basic types all have corresponding wrappers:

 

int a = 10000;Integer b = new Integer(10000);

High precision type:

 

 

BigDecimal c;BigInteger d;

BigDecimal supports fixed points of any length, most of which are used for currency calculation.

 

BigInteger supports the calculation of integer numbers of any length.

 

(3) create and initialize Arrays

Like c and c ++, java also supports arrays.

Arrays in c and c ++ can cause very large memory management problems. Therefore, java arrays must be initialized. If the number of arrays exceeds the storage limit, an exception occurs. Efficiency is used for security.

The array is detailed in the following sections.

 

This section briefly introduces how to create basic types and arrays.

 

 

This chapter is here. Thank you.

-----------------------------------

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.