I keep getting a number format exception on my parseInt areas of code, saying that I am trying to convert null to an int. I input number in the input area of the screen, why won't it read my input?
package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int maximum = Integer.MIN_VALUE;
int N = Integer.parseInt(reader.readLine());
while(N>0){
int r = Integer.parseInt(reader.readLine());
if(r>maximum){
r = maximum;
}
}
System.out.println(maximum);
}
}