当前位置:网站首页>Literals and type conversions of basic data types

Literals and type conversions of basic data types

2022-06-25 20:28:00 brent

Basic data type :

 plastic :byte( position ),short( Short ),int( integer ),long( Long integer );  The default literal value is int type .

 floating-point :float( Single precision floating point ),double( Double precision floating point ); The default literal value is double type .

Literal suffix :

1.  Integer type followed by uppercase L Or lowercase l   --   Indicates that the literal value is long type 

2.  Decimal type followed by uppercase F Or lowercase f   --   Indicates that the literal value is float type 

3.  Decimal type followed by uppercase D Or lowercase d  --   Indicates that the literal value is double type  

Type conversion :

 Automatic type conversion ( From small to large / Implicit conversion ):
** Assign values or variables with small data type ranges to variables with large data type ranges **
 Cast ( From big to small / Display conversion ):
** Assign a value or variable representing a large data range type to a variable representing a small data range type .( Pay attention to the conversion process **
** Data loss problem )**

image.png
image.png

原网站

版权声明
本文为[brent]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202181644113523.html