JAVA8 basic types

After so many years of development, I only know how to use it, how to use it, what I use, and vaguely know why, but why JAVA is always like a woman with a half-covered pipa Not tired? Because the foundation is not solid.

 

1.byte 8th place

  This stuff is rarely used. If it is to save space, and the number is not between -128 ~ 127, please note that all English letters and other symbols and other symbols are converted to binary before this number. Why? Letters or symbols can be represented by numerical values.

The default is 0.

 

2.short 16 bits

The minimum value is -32768 (-2 ^ 15);

The maximum value is 32767 (2 ^ 15-1);

If byte is small and int wants to save space, then use short

 The default is 0.

 

3.int 32nd

  It is used most often, regardless of the small and big take-all. But if the number is small, it is best to use other small types in the habit of a good programmer.

4.long 64 bit

private static final long serialVersionUID = -7729623372590499965L;

Everyone remembers, so many numbers, int can not be installed, then use long, the default is 0.

5. Float floating point single precision 32 bit

6.double floating point double precision 64 bit

7.boolean 1 bit default false

8.char 16-bit storage character

 A Chinese character is two bytes (under unicode encoding)

 (A Chinese character is a byte under ASC encoding)

 That is, one char can put one Chinese character because it is two bytes.

 

 

 

Published 51 original articles · won praise 4 · Views 7877

Guess you like

Origin blog.csdn.net/u012174809/article/details/104628405