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

边栏推荐
- Kotlin learning quick start (7) -- wonderful use of expansion
- AcWing 3438. Number system conversion
- [combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
- 在iptables防火墙下开启vsftpd的端口
- [combinatorics] recursive equation (general solution structure of recursive equation with multiple roots | linear independent solution | general solution with multiple roots | solution example of recu
- RedHat 6.2 配置 Zabbix
- Résolution de l'instance d'assemblage - - affichage à l'écran en mode réel
- 汇编实例解析--实模式下屏幕显示
- HP 阵列卡排障一例
- Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
猜你喜欢

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

聊聊接口优化的几个方法

PHP online confusion encryption tutorial sharing + basically no solution
![[UE4] brush Arctic pack high quality Arctic terrain pack](/img/e7/bc86bd8450b0b2bdec8980a2aa1a10.jpg)
[UE4] brush Arctic pack high quality Arctic terrain pack

Unity notes unityxr simple to use

Static program analysis (I) -- Outline mind map and content introduction

Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)

29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
![[try to hack] active detection and concealment technology](/img/43/d48f851268fec566ce0cc83bd9557e.png)
[try to hack] active detection and concealment technology

人生还在迷茫?也许这些订阅号里有你需要的答案!
随机推荐
How SVN views modified file records
[combinatorics] recursive equation (definition of general solution | structure theorem of general solution of recursive equation without multiple roots)
数仓任务里面 跑SQL任务的时候用的数据库账号是在哪里配置的
Résolution de l'instance d'assemblage - - affichage à l'écran en mode réel
Build your own website (23)
Simple use of unity pen XR grab
Open vsftpd port under iptables firewall
Static program analysis (I) -- Outline mind map and content introduction
27. Input 3 integers and output them in descending order. Pointer method is required.
Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
设计电商秒杀
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
Kotlin learning quick start (7) -- wonderful use of expansion
简单配置PostFix服务器
C语言字符串练习
29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
New library online | cnopendata complete data of Chinese insurance institution outlets
Where is the monitoring page of RDS database?
[combinatorics] recursive equation (special solution example 1 Hannover tower complete solution process | special solution example 2 special solution processing when the characteristic root is 1)
Design e-commerce spike