⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 continueexample.java

📁 java程序设计 清华出版社 孙燮华老师编写的程序源代码
💻 JAVA
字号:
//ContinueExample.java
public class ContinueExample{
  public static void main(String[] args){
    StringBuffer searchMe = new StringBuffer(
      "Peter Piper picked a peck of pickled peppers");
    int max = searchMe.length();
    int numPs = 0;
    for(int i = 0;i<max;i++){
      if(searchMe.charAt(i) != 'p')    //找出字符p
        continue;
      numPs++;                         //累加P的数目
      searchMe.setCharAt(i,'P');       //将'p'转换为'P'
    }
    System.out.println("Found " + numPs + " p's in the old string.");
    System.out.println("The new string is: "); 
    System.out.println(searchMe);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -