substringexample.java
来自「程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件」· Java 代码 · 共 17 行
JAVA
17 行
package examples.basic;
/** A class to demonstrate how to use String.substring
* method
*/
public class SubstringExample {
/** The test method for the class
* @param args Not used
*/
public static void main( String[] args ) {
String s1 = new String( "The quick brown fox" );
String s2 = s1.substring( 4, 8 );
String s3 = s1.substring( 4, 9 );
System.out.println( "The second word is " + s2 );
System.out.println( "The second word is " + s3 );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?