我想知道是否可以将所有字符串数组的结果打印到一个 println 而不是多个。
String[] test1 = { "a", "b", "c" };
String[] test2 = { "a", "B", "c", "D", "e" };
String[] test3 = { "A", "B", "C", "D" };
String[] test4 = { "$", "B", "c", "6", "D", "\n", "E" };
int upperCaseCount1 = countUppercase(test1); //Instead of printing this
System.out.println(upperCaseCount1);
int upperCaseCount2 = countUppercase(test2);
System.out.println(upperCaseCount2);
int upperCaseCount3 = countUppercase(test3);
System.out.println(upperCaseCount3);
int upperCaseCount4 = countUppercase(test4);
System.out.println(upperCaseCount4);
//am i able to use a single line print? like....my failed attempts here.
System.out.println(countUppercase("test1", "test2","test3", "test4");
POPMUISE
相关分类