Is it because i use array? Output of the program shows correct maximum. Please someone give me a hint. Thanks
package com.codegym.task.task04.task0419;
/*
Maximum of four numbers
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] pole = new int[4];
for (int i = 0; i < pole.length-1; i++){
pole[i] = Integer.parseInt(reader.readLine());
}
int max = pole[0];
for (int i = 1; i < pole.length-1; i++){
if (max <= pole[i])
max = pole[i];
}
System.out.println(max);
}
}