public class Test
{
public static void main(String[] args)
{
Boolean [] arr = new Boolean[ 2 ];
List<Boolean> list = new ArrayList<>();
list.add(arr[ 0 ]);
list.add(arr[ 1 ]);
}
}
The above code adds null to list as default value for Boolean is null and as its a reference and so the def vals are assigned, but the local variables shouldnot be initialised with default vals ? how it happens here ?