本人是菜鸟一只,谁能告诉我第2个空应该填什么啊?
//Java_1.java,字符串类的startsWith()和endsWith()方法
import javax.swing.*;
public class Java_1 {
public static void main( String args[] ){
String strings[] = { "started", "starting", "ended", "ending" };
String output = "";
//测试startsWith()方法
for ( int i = 0; i < strings.length; i++ )
if ( strings[ i ].startsWith( "st" ) )
output += "\"" + strings[ i ] + "\" 开始于 \"st\"\n";
output += "\n";
//从字符串第2个字符开始
for ( int i = 0; i < strings.length; i++ )
if ( strings[ i ].startsWith( "art", 2 ) )
output += "\"" + strings[ i ] + "\" 开始于 \"art\" 第2个字符位置\n";
output += "\n";
//测试endsWith()方法
for ( int i = 0; i < strings.length; i++ )
//*********Found********
if ( strings[ i ].endsWith( "____________" ) )
output += "\"" + strings[ i ] + "\" 结束于 \"ed\"\n";
JOptionPane.showMessageDialog( null, output,"显示字符串类的比较");
//*********Found********
JOptionPane._________________________ );
System.exit( 0 );
}
}