java - 在一行中打印多个字符变量?

标签 java char

所以我只是想知道是否有一种方法可以在一行中打印出多个 char 变量,而不会像传统打印语句那样将 Unicode 添加在一起。

例如:

char a ='A'; 
char b ='B'; 
char c ='C';
System.out.println(a+b+c); <--- This spits out an integer of the sum of the characters

最佳答案

System.out.println(a+""+b+""+c);

或:

System.out.printf("%c%c%c\n", a, b, c);

关于java - 在一行中打印多个字符变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19169185/

相关文章:

Java char Array - 删除元素

java - hibernate 不设置外键

java - Spring Boot Actuate 实例化错误

java - 开关结构 : entering a zip code to associate it with a geographic area but only returning the first digit?

c++ - 为什么打印c样式字符串的 'address of index n'导致输出子字符串

java - 比较两个存储由 "#"分隔的整数值的字符串数组

java - 在 Java 中将字符转换为整数

java - 保存类别时如何设置父类别?

Java 文字值赋值行为

intellij 中的 JavaFX