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

边栏推荐
- 29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
- C语言按行修改文件
- 1164 Good in C
- Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
- [RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
- STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
- Apache service suspended asynchronous acceptex failed
- C language string inversion
- PHP online confusion encryption tutorial sharing + basically no solution
- Play with fancy special effects. This AE super kit is for you
猜你喜欢

跨境电商:外贸企业做海外社媒营销的优势

Applet setting multi account debugging

PHP online confusion encryption tutorial sharing + basically no solution
![Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)](/img/be/4ef38f711e7319a2cc83db2bee3a07.jpg)
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)

Swm32 series Tutorial 4 port mapping and serial port application

Free data | new library online | cnopendata complete data of China's insurance intermediary outlets

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

One brush 145 force deduction hot question-2 sum of two numbers (m)
![[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework](/img/df/a7719bcb00ff66e21f3a391ab94573.png)
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework

One brush 147-force deduction hot question-4 find the median of two positive arrays (H)
随机推荐
Solution to long waiting time of SSH connection to remote host
VM11289 WAService. js:2 Do not have __ e handler in component:
Stm32h7 Hal library SPI DMA transmission has been in busy solution
What is your income level in the country?
27. 输入3个整数,按从大到小的次序输出。要求用指针方法实现。
[error reporting] omp: error 15: initializing libiomp5md dll, but found libiomp5md. dll already initialized.
AcWing 3438. Number system conversion
简单配置PostFix服务器
Vs code plug-in korofileheader
An example of HP array card troubleshooting
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
Installation and configuration of network hard disk NFS
线程池:业务代码最常用也最容易犯错的组件
[combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
線程池:業務代碼最常用也最容易犯錯的組件
Kubernetes resource object introduction and common commands (4)
鸿蒙第四次培训
跨境电商:外贸企业做海外社媒营销的优势
大消费企业怎样做数字化转型?
Open vsftpd port under iptables firewall