提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
继续下一个迭代
class ContinueDemo { public static void main(String[] args) {/*来 自 n o w j a v a . c o m - 时 代 Java*/ String searchMe = "peter piper picked a " + "peck of pickled peppers"; int max = searchMe.length(); int numPs = 0; for (int i = 0; i < max; i++) { // interested only in p's if (searchMe.charAt(i) != 'p') continue; // process p's numPs++; } System.out.println("Found " + numPs + " p's in the string."); } }