Sunday, April 27, 2014

Java Beginner: Question




There are some subtleties, especially when initializing arrays.






Java Code:






int [] a = {1,2,3}; // okay
int [] x;
x = {1,2,3}; // compiler error - must do it like x = new int[]{1,2,3}




Regards,



Jim




No comments:

Post a Comment