I feel like I've solved the task as far as I can, but I'm not sure why I'm getting all these exception errors. I'm guessing it has something to do with either my loop never ending, or the fact that it can't handle parsing empty fields or something when it runs out of numbers.
Any ideas?
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 = 0;
int i = Integer.parseInt(reader.readLine());
if (i > maximum) {
maximum = i;
System.out.println(maximum);
}
else;
while (true) {
i = Integer.parseInt(reader.readLine());
if (maximum<i)
maximum = i;
else;
if (i>0)
System.out.println(maximum);
else;
}
}
}