当前位置:网站首页>Type conversion, variable
Type conversion, variable
2022-07-03 17:20:00 【Onycho】
Type conversion

```public class Demo03 {
public static void main(String[] args) {
int i = 128;
//byte b = (byte) i; // out of memory
double b = i;
// Coercive transformation ( type ) Variable name High to low
// Automatic conversion Low to high
System.out.println(i);
System.out.println(b);
/* Be careful 1. Cannot convert Boolean values 2. You cannot convert an object type to an unrelated type 3. Force conversion when converting high capacity to low capacity 4. There may be memory overflow during conversion , Or accuracy issues */
System.out.println("=====================");
System.out.println((int)23.7); //23
System.out.println((int)-45.89f); //-45
System.out.println("=====================");
char c = 'a';
int d = c+1;
System.out.println(d);
System.out.println((char)d);
}
}
Output
128
128.0
=====================
23
-45
=====================
98
b
Variable

边栏推荐
- Installation and configuration of network hard disk NFS
- One brush 145 force deduction hot question-2 sum of two numbers (m)
- PS screen printing brush 131, many illustrators have followed suit
- New library online | cnopendata China bird watching record data
- 大消费企业怎样做数字化转型?
- kubernetes资源对象介绍及常用命令(三)
- POM in idea XML graying solution
- A day's work list of an ordinary programmer
- Hongmeng fourth training
- Talk about several methods of interface optimization
猜你喜欢

【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用

QT学习日记9——对话框

TensorBoard快速入门(Pytorch使用TensorBoard)

【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用

vs2013已阻止安装程序,需安装IE10

UE4 official charging resources, with a total price of several thousand

1164 Good in C

C语言按行修改文件

How to train mask r-cnn model with your own data

国内如何购买Google Colab会员
随机推荐
免费数据 | 新库上线 | CnOpenData中国保险中介机构网点全集数据
Define a structure fraction to represent a fraction, which is used to represent fractions such as 2/3 and 5/6
Host based intrusion system IDS
Open vsftpd port under iptables firewall
[RT thread] NXP rt10xx device driver framework -- RTC construction and use
1164 Good in C
Build your own website (23)
C语言字符串练习
Qt调节Win屏幕亮度和声音大小
【Try to Hack】主动侦查隐藏技术
Prepare for the golden three silver four, 100+ software test interview questions (function / interface / Automation) interview questions. win victory the moment one raises one 's standard
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
AcWing 3438. 数制转换
定义一个结构体Fraction,表示分数,用于表示 2/3, 5/6这样的分数
C language string practice
Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022
设计电商秒杀
How do large consumer enterprises make digital transformation?
SVN完全备份svnadmin hotcopy
[combinatorics] recursive equation (solution of linear non-homogeneous recursive equation with constant coefficients | standard form and general solution of recursive equation | proof of general solut