当前位置:网站首页>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

边栏推荐
- Kubernetes resource object introduction and common commands (4)
- Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022
- One brush 147-force deduction hot question-4 find the median of two positive arrays (H)
- Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
- Leetcode13. Roman numeral to integer (three solutions)
- Online assignment 3 of mobile Internet technology in the 20th autumn of electronic technology [standard answer]
- 匯編實例解析--實模式下屏幕顯示
- 国内如何购买Google Colab会员
- 跨境电商:外贸企业做海外社媒营销的优势
- RedHat 6.2 configuring ZABBIX
猜你喜欢

Depth first search of graph

Select 3 fcpx plug-ins. Come and see if you like them

What is your income level in the country?

SWM32系列教程4-端口映射及串口应用
![[UE4] brush Arctic pack high quality Arctic terrain pack](/img/e7/bc86bd8450b0b2bdec8980a2aa1a10.jpg)
[UE4] brush Arctic pack high quality Arctic terrain pack

29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)

Cross border e-commerce: advantages of foreign trade enterprises in overseas social media marketing
![Luogu: p2685 [tjoi2012] Bridge](/img/f5/f77027288a211ae466781b09ce650f.jpg)
Luogu: p2685 [tjoi2012] Bridge

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

【RT-Thread】nxp rt10xx 设备驱动框架之--Pin搭建和使用
随机推荐
静态程序分析(一)—— 大纲思维导图与内容介绍
人生还在迷茫?也许这些订阅号里有你需要的答案!
手把手带你入门 API 开发
C语言字符串练习
[combinatorics] recursive equation (definition of general solution | structure theorem of general solution of recursive equation without multiple roots)
RedHat 6.2 configuring ZABBIX
How to train mask r-cnn model with your own data
新库上线 | CnOpenData中国保险机构网点全集数据
One brush 145 force deduction hot question-2 sum of two numbers (m)
TensorBoard快速入门(Pytorch使用TensorBoard)
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
企业级自定义表单引擎解决方案(十一)--表单规则引擎1
SVN完全备份svnadmin hotcopy
RedHat 6.2 配置 Zabbix
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
A day's work list of an ordinary programmer
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 device driver framework -- pin construction and use
汇编实例解析--实模式下屏幕显示