我已经看到了在Java中定义静态数组的不同方法。要么:
String[] suit = new String[] {
"spades",
"hearts",
"diamonds",
"clubs"
};
...或仅
String[] suit = {
"spades",
"hearts",
"diamonds",
"clubs"
};
或作为 List
List suit = Arrays.asList(
"spades",
"hearts",
"diamonds",
"clubs"
);
有区别吗(当然除了List定义)?
有什么更好的方法(明智的选择)?