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

边栏推荐
- Hongmeng fourth training
- Select 3 fcpx plug-ins. Come and see if you like them
- [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
- [RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
- VM11289 WAService. js:2 Do not have __ e handler in component:
- What is your income level in the country?
- Open vsftpd port under iptables firewall
- C language modifies files by line
- C language string practice
- PHP online confusion encryption tutorial sharing + basically no solution
猜你喜欢

国内如何购买Google Colab会员

Take you to API development by hand

Test your trained model

TensorBoard快速入门(Pytorch使用TensorBoard)

Simple use of unity pen XR grab

【JokerのZYNQ7020】DDS_ Compiler。

新库上线 | CnOpenData中国保险机构网点全集数据

免费数据 | 新库上线 | CnOpenData中国保险中介机构网点全集数据
![[RT thread] NXP rt10xx device driver framework -- Audio construction and use](/img/85/32a83eaa4b7f5b30d4d7c4f4c32791.png)
[RT thread] NXP rt10xx device driver framework -- Audio construction and use
![[RT thread] NXP rt10xx device driver framework -- pin construction and use](/img/75/b4f034bfe49409f76e7fd92758804e.png)
[RT thread] NXP rt10xx device driver framework -- pin construction and use
随机推荐
SSH连接远程主机等待时间过长的解决方法
Hongmeng fourth training
[UE4] brush Arctic pack high quality Arctic terrain pack
Open vsftpd port under iptables firewall
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
Redis:关于列表List类型数据的操作命令
RDS数据库的监测页面在哪看?
Assembly instance analysis -- screen display in real mode
[combinatorics] recursive equation (characteristic equation and characteristic root | example of characteristic equation | root formula of monadic quadratic equation)
Dagong 21 autumn "power plant electrical part" online operation 1 [standard answer] power plant electrical part
鸿蒙第三次培训
[combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
一位普通程序员一天工作清单
绝对定位时元素水平垂直居中
[RT thread] NXP rt10xx device driver framework -- Audio construction and use
聊聊接口优化的几个方法
One brush 148 force deduction hot question-5 longest palindrome substring (m)
[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
AcWing 3438. Number system conversion
[combinatorics] recursive equation (definition of general solution | structure theorem of general solution of recursive equation without multiple roots)