I want to teach myself java, and stumbled upon a problem. Coming from a python background, I would define an array (or list) like a = [] and then do something like a = [1,2,3,4,5]
In java, if I define an array like int[] a, I cannot assign values to it like a = {1,2,3,4,5};
Why? I certainly can initialize it like int[] a {1,2,3,4,5};
, but why not assign it?
thx.