要求用小程序:
     大概就是在一个界面中输入三个数,结果能够返回三个数的最大值,最小值及中间值.
  希望大家来帮忙解决一下.

解决方案 »

  1.   

    import java.io.*;
    public class Test
    {
       public static void main(String[] args)
       {
           String s="";
           int []a=new int[3];
           int i;
           int j;
           int T;
           for(i=0;i<3;i++)
           try
           {
             System.out.print("请输入一个数字:");
             BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
             s=in.readLine();
             a[i]=Integer.parseInt(s);       }catch(IOException e){}
           for(i=0;i<2;i++)
            for(j=1;j<3;j++)
              if (a[i]<a[j])
                 {
                    T=a[i];
                    a[i]=a[j];
                    a[j]=T;
                 }
           System.out.println("最大值是:" + a[0] + "中间值是:" + a[1] + "最小值是:" + a[2]);
       }
    }