I have a question about initialization. When we initialize an array with { }, we must do it right after declaration to show compiler which type to use. Why does compiler allow diamond operator do it with 2 statements?
Integer[] array = {2,4,5};
//Integer[] array; array = {2,4,5}; - error
List<Integer> list = new ArrayList<>();
//List<Integer> list; list = new ArrayList<>(); - no error