實例化的變量在Python中,你可以做到以下幾點:的Java:從陣列
myList = [1, 2, 3, 4]
a, b, c, d = myList
print a # -> 1
print d # -> 4
有沒有辦法做這樣的事情在Java中?比下面更好/更快:
int[] myList= {1, 2, 3, 4};
int a = myList[0];
int b = myList[1];
int c = myList[2];
int d = myList[3];
號Java沒有這種機制。 – Pshemo
你可以嘗試http://stackoverflow.com/questions/12328327/java-quick-way-of-assigning-array-values-to-individual-variables –
nope,不可能在短 –