Код: Выделить всё
import java.util.Scanner;
public class Maximizer {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int max = Integer.MIN_VALUE;
for (int i = 0; i < n; i++) {
int value = input.nextInt();
max = (value > max) ? value : max;
}
System.out.println("The largest number was " + max + ".");
}
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... il-scanner