このファイル内に最大数と最小数を印刷する必要があります...すべてを試しましたが、機能しないようです。私は初心者です助けてください
public class Banck {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("Welcome to JEEEZBANK");
final int NUM_TO_QUIT = -99;
String userin ;
int num;
System.out.println("Enter a file ending with .txt");
Scanner scan = new Scanner(System.in);
userin = scan.nextLine();
// create file
PrintWriter file = new PrintWriter(userin);
for(int i=1; i<5; i++){
System.out.println("enter first number "+i +" or -99 to quit");
num = scan.nextInt();
if(num == NUM_TO_QUIT){
System.out.println("bye");
System.exit(0);
}
file.println(num);
}
file.close();
// read file and print smallest and biggest number
Scanner read = new Scanner(file);
while(read.hasNext()){
// add the numbers to the array
int[] numlist = {num};
// print the biggest and smallest number inside the numlist array.
}
}
}