我需要打印“ H3110 w0r1d 2.0 true ”作为输出。下面是编写并获得输出为“3182 w0r1d 2.0 true”的代码。
public class HelloWorld {
public static void main (String[] args){
char c1= 'H';
int num1 = 3110;
char c2='w';
byte b=0;
char c3='r';
int y=1;
char c4='d';
float f = 2.0f;
boolean bool= true;
String s = c1+num1 + " " + c2+b+c3+y+c4 + " " + f + " " + bool;
System.out.println(s);
}
}
Run Code Online (Sandbox Code Playgroud)
查询:如果我连接H和3110,则打印为3182。为什么这样?