Seeing JAVA-Data Type & Operation-03

Seeing JAVA-Data Type & Operation-03

Strongly typed language

java is a strongly typed language

basic type

byte 1B

short 2B

Int 4B

long 8B

float 4B (use with caution, about =)

double 8B

用BigDecimal

char 2B

String! is the class

boolean 1b

Reference type

Except 8 basic types are reference types

Forced conversion

High-low

overflow

Loss of accuracy

Automatic conversion

Low-high

variable

Class variable static

Instance variable: subordinate to the object, there is a default value if it is not initialized by itself, the default value of boolean is false, and the default value is null except for basic types

Local variables must be declared and initialized

constant

static final

Variable capitalization

Operator

When performing operations on different basic types of data

Convert long with long

Convert int without long

a++,++a

Auto-increment after executing the code

Bit operation

Extremely efficient

,<< *2

String concatenation+

The content has a string, it will become String

But there are operations in front of the string, and then it becomes a String

Ternary operator

X ?a;b

X judgment, true output a; false output b

Guess you like

Origin blog.csdn.net/rr18758236029/article/details/108401732