1 Star 0 Fork 0

losidk/java_notes

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Demo08Plus.java 602 Bytes
一键复制 编辑 原始数据 按行查看 历史
losidk 提交于 2021-04-23 07:50 +08:00 . init
public class Demo08Plus {
public static void main (String[] args){
/*
java 中的加法:
1. 加法运算符两边都是数值的时候执行普通的加法运算
2. char 类型的数值参加运算时,会首先将char 类型提升为int类型,然后参与运算
3. String 类型的值和一切 类型的值进行加法运算,都会进行 链接操作
*/
char char1 = 'A';
String str1 = "Hello";
System.out.println(str1+10); // Hello10
System.out.println(str1+ 10 + 1); // Hello101
System.out.println(str1+char1); // HelloA
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/losidk/java_notes.git
git@gitee.com:losidk/java_notes.git
losidk
java_notes
java_notes
master

搜索帮助