import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.println("输入字符串:");
String str=in.nextLine();
System.out.println("结果:"+str.substring(str.indexOf(" ")+1));
}
}
啥意思?啥叫不用语句?
用nextLine()就可以输入带空格的字符串,直到换行位置
搜索字符串,找到最后一个空格的位置,然后输出空格以后的所有字符