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

📄 ch6ex19.java

📁 JAVA程序设计 丁岳伟 彭敦陆编著 高等教育出版社示例代码可供JAVA初学者学习
💻 JAVA
字号:
public class ch6ex19{
  public static void main(String[] args) {
    String s1="Computer";
    String s = "My "+s1+" course is "+Integer.toString(87);
    System.out.println(s);
    // The "equivalent" using StringBuffer:
    StringBuffer sb = 
      new StringBuffer("My "); // Creates String!
    sb.append(s1);
    sb.append(" course is "); // Creates String!
    sb.append(Integer.toString(87));
    System.out.println(sb);
    //insert not after is
    sb.insert(21," not");
    String st=sb.toString();
    System.out.println(st);
    //delete the word Computer
    sb.delete(3,12);
    System.out.println(sb);
    System.out.println("The buffer capacity is "+sb.capacity());
    System.out.println("The string length is "+sb.length());
  }
} 

⌨️ 快捷键说明

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