Reputation: 572
My question boils down to: Why does
Object test = {"2"};
not work while
String[] test = {"2"};
Object bla = test;
does?
Upvotes: 0
Views: 69
Reputation: 1130
It is because the compiler thinks that {"2"} it is an array but if you declare directly with an object you have to specify it is gonna be an array too.
Upvotes: 2