Java INDEPENDENT TOPIC 02 – VARARGS LESSON WORK QUESTION
1 Write the
function countChar
that will get an array of Strings as parameter and output the total number of
characters in all the Strings passed in.
You should use varargs. Your function should work with the main
function below (which you should copy into your class). public static void main(String[] args) { System.out.println(countChar("a",
"b", "c", "d", "e", "f", "g",
"h",)); int tot = countChar("Skyrim", "Zelda", "SMB3",
"Contra", "Ultima"); System.out.println(tot); } |
|