58,454
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner rd=new Scanner(System.in);
int n=rd.nextInt();
String str[]=new String[n];
for(int i=0;i<str.length;i++)
{
str[i]=rd.nextLine();
}
int m=rd.nextInt();
copy(str,m);
}
public static void copy(String[] str,int m)
{
String a[]=new String[(str.length-m)+1];
System.arraycopy(str, m, a, 0, a.length);
for(int i=0;i<a.length;i++)
{
System.out.print(a[i]);
}
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
Scanner rd=new Scanner(System.in);
int n=rd.nextInt();
rd.nextLine(); //去掉回车换行的影响.
String str;
do //输入的字符串长度不等于n,重输入。
{
str=rd.next();
}while(str.length()!=n);
int m=rd.nextInt();
copy(str,m);
}
public static void copy(String str,int m)
{
String temp=str.substring(m); //关键就这句.
System.out.println("new string is "+temp);
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
Scanner rd=new Scanner(System.in);
int n=rd.nextInt();
rd.nextLine(); //去掉回车换行的影响.
String str[]=new String[n];
for(int i=0;i<str.length;i++)
{
str[i]=rd.nextLine();
}
int m=rd.nextInt();
copy(str,m);
}
public static void copy(String[] str,int m)
{
String a[]=new String[(str.length-m)]; //再加 1 就越界了。
System.arraycopy(str, m, a, 0, a.length);
for(int i=0;i<a.length;i++)
{
System.out.print(a[i]);
}
}