import java.io.*;
class parents
{ public static int [] Delete(int [] a,int k,int N)
{ for(int i=k;i<N-1;i++)
a[i]=a[i+1];a[9]=0;
return a;
}
void show()
{ System.out.println("以下是对数组的应用.");
}
class child extends parents
{ static int [] B(int [] a,int x,int y)
{ a=super.Delete(a,x,y);super.show();
return a;
}
}
class Test4
{ public static void main(String args[])
throws IOException
{ int a[]=new int[10];
int s;
for(int i=0;i<10;i++)
a[i]=(int)(100*Math.random());
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("您想删除第几个数字?(0<s<9)");
do
{ s=Inter.parseInt(br.readLine());
if(s<0|s>9)
System.out.println("输入错误!请重新输入:(0<s<9)");
}
while(s<0|s>9);
child c=new child();
a=c.B(A,s,10);
for(int j=0;j<10;j++)
System.out.print(a[j]+" ");
System.out.print("\n");
}
}
}
这个程序有什么错误呀。
class parents
{ public static int [] Delete(int [] a,int k,int N)
{ for(int i=k;i<N-1;i++)
a[i]=a[i+1];a[9]=0;
return a;
}
void show()
{ System.out.println("以下是对数组的应用.");
}
class child extends parents
{ static int [] B(int [] a,int x,int y)
{ a=super.Delete(a,x,y);super.show();
return a;
}
}
class Test4
{ public static void main(String args[])
throws IOException
{ int a[]=new int[10];
int s;
for(int i=0;i<10;i++)
a[i]=(int)(100*Math.random());
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("您想删除第几个数字?(0<s<9)");
do
{ s=Inter.parseInt(br.readLine());
if(s<0|s>9)
System.out.println("输入错误!请重新输入:(0<s<9)");
}
while(s<0|s>9);
child c=new child();
a=c.B(A,s,10);
for(int j=0;j<10;j++)
System.out.print(a[j]+" ");
System.out.print("\n");
}
}
}
这个程序有什么错误呀。
import java.io.*;class parents {
public static int[] Delete(int[] a, int k, int N) {
for (int i = k; i < N - 1; i++)
a[i] = a[i + 1];
a[9] = 0;
return a;
} void show() {
System.out.println("以下是对数组的应用.");
}}class child extends parents {
int[] B(int[] a, int x, int y) {
a = super.Delete(a, x, y);
super.show();
return a;
}
}public class Test5 {
public static void main(String args[]) throws IOException {
int a[] = new int[10];
int s;
for (int i = 0; i < 10; i++)
a[i] = (int) (100 * Math.random());
BufferedReader br = new BufferedReader(new InputStreamReader (System.in));
System.out.println("您想删除第几个数字?(0<s<9)");
do {
s = Integer.parseInt(br.readLine());
if (s < 0 | s > 9)
System.out.println("输入错误!请重新输入:(0<s<9)");
} while (s < 0 | s > 9);
child c = new child();
a = c.B(a, s, 10); for (int j = 0; j < 10; j++)
System.out.print(a[j] + " ");
System.out.print("\n");
}
}
public static void main(String args[]) throws IOException {
int a[] = new int[10];
int s;
for (int i = 0; i < 10; i++)
a[i] = (int) (100 * Math.random());
BufferedReader br = new BufferedReader(new InputStreamReader (System.in));
System.out.println("您想删除第几个数字?(0<=s<=9)");
do {
s = Integer.parseInt(br.readLine());
if (s < 0 || s > 9)
System.out.println("输入错误!请重新输入:(0<=s<=9)");
} while (s < 0 || s > 9);
child c = new child();
a = c.B(a, s, 10); for (int j = 0; j < 10; j++)
System.out.print(a[j] + " ");
System.out.print("\n");
}
}