当前位置 : 主页 > 编程语言 > c++ >

7-1 jmu-Java-02基本语法-02-StringBuilder

来源:互联网 收集:自由互联 发布时间:2021-06-30
gistfile1.txt import java.util.Scanner;public class Main { private static Scanner in; public static void main(String[] args) { int n,x,y; in=new Scanner(System.in); while(true) { StringBuilder s=new StringBuilder(""); n=in.nextInt(); x=in.n
gistfile1.txt
import java.util.Scanner;
public class Main {
    private static Scanner in;
    public static void main(String[] args)
    {
        int n,x,y;
        in=new Scanner(System.in);
        while(true)
        {
            StringBuilder s=new StringBuilder("");
            n=in.nextInt();
            x=in.nextInt();
            y=in.nextInt();
            for(int i=0;i
 
  0)
            {
                System.out.println(s.substring(x,y));
            }
            else if(x>y&&y>0)
            {
                System.out.println(s.substring(y,x));
            }
        }
    }
}
 
网友评论