Java初涉之1--Java中的 "+"
来源:互联网 发布:js 判断invalid date 编辑:程序博客网 时间:2024/06/01 09:22
package day01;public class Test { public static void main(String[] args) { // TODO Auto-generated method stub String s1 = "abc"; int a = 1; int b = 2; int c = 3; System.out.println(a+b+c+s1);//6abc System.out.println(s1+a+b+c);//abc123 System.out.println(a+b+s1+c);//3abc3 }
It is easy to detect that when the first is not the string ,so “+” do as the mathematical operator.If the first is string ,so “+” from this to end is string concatenation.
Tips:
mathematical operator :数学运算符
string concatenation:字符串连接
concatenation[kənkætə’neɪʃn]: A concatenation of things or events is a series of them linked together. 连结
0 0
- Java初涉之1--Java中的 "+"
- java中的tryCatch之
- Java初涉之3--考试中的一些问题
- Java之美之Java中的IO
- Java中的Annotation解析之二(1)
- java基础之java中的基本数据类型
- java学习心得之--java中的修饰符
- Java学习笔记之Java中的包
- Java学习之java中的常用类
- JAVA开发之 22-JAVA中的变量
- JAVA开发之 27-Java中的程序结构
- Java基础之Java中的方法
- java笔记之java中的集合框架
- java笔记之java中的io
- Java中的封装之我见
- Java中的封装之我见
- Java中的封装之我见
- java中的String之intern()
- 隐藏指定的UIView区域
- java学习之字符串(上)
- 【整、借、学、变】四字谈起
- java基础—System类的方法演示
- DayDayUP_Linux运维学习_c.vim插件安装和使用
- Java初涉之1--Java中的 "+"
- CoreSpotlight.framework注释翻译
- Mono2.0 对C#闭包 与 donet 不同的实现导致Unity的Bug 及解决方案
- hdu5273 n次查询求逆序数对
- 黑马程序员JAVA笔记3--面向对象
- printf格式化输出
- [BZOJ 4096] Usaco2013 dec Milk Scheduling · 贪心
- AndroidStudio新建项目时一直处于building“xxx”gradle project info状态
- DeepLearnToolBox中CNN源码解析