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

📄 substring.java

📁 金旭亮的java教案
💻 JAVA
字号:
// SubString.java
// This program demonstrates the
// String class substring methods.
import javax.swing.*;

public class SubString {
   public static void main( String args[] )
   {
      String letters = "abcdefghijklmabcdefghijklm";
      String output;

      // test substring methods
      output = "Substring from index 20 to end is " +
               "\"" + letters.substring( 20 ) + "\"\n";

      output += "Substring from index 0 up to 6 is " +
                "\"" + letters.substring( 0, 6 ) + "\"";
                //(起始下标,要拷贝子串的最后下标加1但不包括该下标)

      JOptionPane.showMessageDialog( null, output,
         "Demonstrating String Class Substring Methods",
         JOptionPane.INFORMATION_MESSAGE );

      System.exit( 0 );
   }
}

⌨️ 快捷键说明

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