public class Solution { public static void main(String[] args) { printChars('1', 'Z', 10); } public static void printChars(char ch1, char ch2, int numberPerLine) { int count = 0; int start = (int)ch1; int end = (int)ch2; for(int i = start; i <= end; i++) { System.out.print((char)i + " "); count++; if(count == numberPerLine) { System.out.println(); count = 0; } } } }
相关文章
- 11-29HW5.12