?? exercise7_19.java
字號:
// Exercise7_19.java: Write a program that passes a string as a
// command-line argument and displays the number of uppercase
// letters in the string.
public class Exercise7_19 {
public static void main(String[] args) {
// Check command-line arguments
if (args.length != 1) {
System.out.println(
"Usage: java Exercise7_19 string");
System.exit(0);
}
String s = args[0];
int total = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) >= 'A' && s.charAt(i) <= 'Z')
total++;
}
System.out.println("The number of uppercase letters is " +
total);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -