Hi friend,
Code to help in solving the problem :
import java.io.*;
class NumberExample
{
public static void main(String[] args) throws Exception
{
String string = "";
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
// read in user input
int ar[] = new int[4];
int count=1;
for(int i=0;i<ar.length;i++)
{
System.out.println("Enter "+count+" number");
ar[i]=Integer.parseInt(reader.readLine());
count++;
}
int min=ar[0];
int max=ar[0];
for(int i=1;i<ar.length;i++)
{
if(ar[i]<min)
{
min = ar[i];
}
if(ar[i]>max)
{
max = ar[i];
}
}
System.out.println("Min " + min);
System.out.println("Max " + max);
}
}
For read more information,Examples and Tutorials on Java visit to :
http://www.roseindia.net/java/Thanks