我怎样才能知道"10"
里面的索引
private static String[] faces = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
用更少的Java代码?
将包裹在String[]
中List
,然后使用indexOf
:
int indexOf10 = Arrays.asList(faces).indexOf("10");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句