Basic type-java

** Basic type ** byte<<short<<int<<long<< float<<double ← Small box Large box →

・ Integer can be assigned to double type ・ Int type and double type operations → double type Reason: The double type is larger Movement to fit larger molds

・ Integer int -2147483648 ~ 2147483647 int i = 100; no decimal point ・ Integer long -9223372036854775808 ~ 9223372036854775807 long lo = 300000L; Add L at the end without decimal point -Integer short -32768 to 32767 ・ Integer byte -128 to 127

Integers are usually used as int type, and I don't understand the significance of byte and short. ** But I have problems with Oracle **

· Boolean boolean boolean Boolean, true or false boolean Win = false; ・ Character type char Unicode character \ u0000 ~ \ uFFFF char A ='A';

sample


            char uni =  ‘¤’; //OK
            char uni2 = U+00A4; //NG Unicode can't be inserted
            char uni3 = ‘U+00A4’; //NG ''It is useless even if it is surrounded by

・ Floating point type float Single precision floating point number With a decimal point, F or f float fo = 30.5f; ・ Floating point type double double precision floating point number double do = 30.5;

Integer type minimum value Maximum value
byte Byte.MIN_VALUE Byte.MAX_VALUE
short Short.MIN_VALUE Short.MAX_VALUE
int Integer.MIN_VALUE Integer.MAX_VALUE
long Long.MIN_VALUE Long.MAX_VALUE

You can get the maximum and minimum values with

Recommended Posts

Basic type-java
Basic knowledge
Ruby basic terms
Basic Programming Resources
Java basic grammar
docker basic command
Docker basic commands
Java basic knowledge 1
[Java] Basic structure
[Java] [Basic] Glossary
[Servlet] Basic method
CentOS8 basic setup
Java basic grammar
Java basic grammar
Ruby_work basic problem
Rails basic philosophy
Java exercises [Basic]
(Git) Basic command