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

边栏推荐
- One brush 142 monotone stack next larger element II (m)
- Vs code plug-in korofileheader
- [combinatorics] recursive equation (constant coefficient linear homogeneous recursive equation | constant coefficient, linear, homogeneous concept description | constant coefficient linear homogeneous
- Swm32 series Tutorial 4 port mapping and serial port application
- 网络硬盘NFS的安装与配置
- RDS数据库的监测页面在哪看?
- SVN如何查看修改的文件记录
- 【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用
- What is your income level in the country?
- Redis:关于列表List类型数据的操作命令
猜你喜欢

Design e-commerce spike

Kubernetes resource object introduction and common commands (4)

kubernetes资源对象介绍及常用命令(四)

Kubernetes resource object introduction and common commands (III)
![[RT thread] NXP rt10xx device driver framework -- RTC construction and use](/img/19/91a9d84ba84f81ef125c33eb4007bc.png)
[RT thread] NXP rt10xx device driver framework -- RTC construction and use

The largest matrix (H) in a brush 143 monotone stack 84 histogram

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

kubernetes资源对象介绍及常用命令(五)-(NFS&PV&PVC)

POM in idea XML graying solution

How to train mask r-cnn model with your own data
随机推荐
29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
[combinatorial mathematics] recursive equation (example of recursive equation 2 Hanoi Tower | example of recursive equation 3 insertion sequencing)
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
Unity notes unityxr simple to use
[combinatorics] recursive equation (characteristic equation and characteristic root | example of characteristic equation | root formula of monadic quadratic equation)
PS screen printing brush 131, many illustrators have followed suit
A day's work list of an ordinary programmer
TensorBoard快速入门(Pytorch使用TensorBoard)
vs2013已阻止安装程序,需安装IE10
C语言字符串反转
Static program analysis (I) -- Outline mind map and content introduction
When absolutely positioned, the element is horizontally and vertically centered
PHP online confusion encryption tutorial sharing + basically no solution
Kotlin learning quick start (7) -- wonderful use of expansion
Hongmeng fourth training
How to train mask r-cnn model with your own data
[combinatorics] recursive equation (constant coefficient linear homogeneous recursive equation | constant coefficient, linear, homogeneous concept description | constant coefficient linear homogeneous
[combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
Hongmeng third training