本帖最后由 air鹏 于 2014-9-8 02:18 编辑
import java.util.*;
class lianxi28
{
public static void main(String[] args)
{
ShuRu sr=new ShuRu();
//PaiXu.paixu(sr.shuru);
//int[] a = sr.arr[];
PaiXu px=new PaiXu();
px.paixu(sr.arr[] );
}
}
class ShuRu
{
public static void shuru()
{
Scanner ss = new Scanner(System.in);
int [] arr = new int [10];
System.out.println("input ");
for (int i=0; i<arr.length;i++)
{
arr= ss.nextInt();
}
}
}
class PaiXu
{
public static void paixu(int[] arr)
{
for(int x=0;x<arr.length;x++)
{
for(int y=0;y<arr.length-1;y++)
{
int t=0;
if(arr[y]>arr[y+1])
{
t=arr[y+1];arr[y+1]=arr[y];arr[y]=t;
}
}
}
}
}
编译提示 12行错误 需要class
|