我在网上看到下面的代码!
import java.util.Scanner;
class Test
{
public static void main(String[] args)
{
System.out.print("请输入5个数");
int[] nums=new int[5];
Scanner jin = new Scanner(System.in);
for (int i = 0; i < nums.length; i++)
{
nums=jin.nextInt();
}
int smallerNum=nums[0];
int biggerNum=nums[0];
for (int i = 0; i < nums.length; i++)
{
System.out.print(" "+nums);
if (smallerNum>nums)
{
smallerNum=nums;
}
if (biggerNum<nums)
{
biggerNum=nums;
}
}