1.当左右两边都是数值型时,则做加法运算
2.当左右两边有一方为字符串,则做拼接运算
3.运算顺序,是从左到右
System.out.printIn(100+98);//198
System.out.printIn("100"+98)://10098
System.out.printIn(100+3+"hello");//103hello
System.out.printIn("hello"+ 100 +3); //hello1003
>char的输出
char c5 ='b'+ 1;//98+1==>99 System.out.println((int)c5);//99 System.out.println(c5);//99->对应的字符->编码表ASCIi(规定好的)=>C>基本数据类型和String类型的转换
1>基本类型转String类型 【语法:将基本类型的值+“”即可】
2>String类型转基本数据类型 【语法:通过基本类型的包装类调用parseXX方法即可】
public class StringToBasic {
public static void main(String[] args){
//基本数据类型->String
int n1 =100; String s1 = n1 + "";
float f1 = 1.1F; String s2 = f1 + "";
double d1 = 4.5; String s3 = d1 + "";
boolean b1 = true; String s4 = b1 + "";
System.out.println(s1+" "+s2+" "+s3+" "+s4);
//String->对应的基本数据类型
//使用 基本数据类型对应的包装类 的相应方法,得到基本数据类型
String s5 = "123";
int num1 = Integer.parseInt(s5);
double num2 = Double.parseDouble(s5);
float num3 = Float.parseFloat(s5);
long num4 = Long.parseLong(s5);
byte num5 = Byte.parseByte(s5);
short num6 = Short.parseShort(s5);
boolean b = Boolean.parseBoolean("true");
System.out.println(num1+" "+num2+" "+num3+"```");
}
}



