I have a text file located in the same folder with some


import java.util.*;
import java.io.*;

public class MainMethodClassName
{
public static void main(String args[])
{

Scanner readFile = null;

try

{

readFile = new Scanner(
new FileInputStream("numbers.txt"));
}


catch(FileNotFoundException e)
{

System.out.println("Sorry, this file could not be found.");
}

int max = readFile.nextInt();
int min = max;
while(readFile.hasNextInt());
{
int next = readFile.nextInt();
if(min > next)
min = next;

if(max < next)
max = next;
}

System.out.println("Maximum number:" + max);
System.out.println("Minimum number:" + min);
}
}

I have a text file located in the same folder with some various numbers, and it won't work. Thanks in advance.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: I have a text file located in the same folder with some
Reference No:- TGS0660875

Expected delivery within 24 Hours