相关文章推荐
爱笑的茶壶  ·  Python - Tuple ...·  1 年前    · 
潇洒的茶壶  ·  Xcode 实用小技巧 - 掘金·  1 年前    · 
气宇轩昂的萝卜  ·  vue ...·  2 年前    · 
public class ArrayToCollection { public static void main ( String args [ ] ) throws IOException { int n = 5 ; // 5 个元素 String [ ] name = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { name [ i ] = String . valueOf ( i ) ; List < String > list = Arrays . asList ( name ) ; System . out . println ( ) ; for ( String li : list ) { String str = li ; System . out . print ( str + " " ) ;

以上代码运行输出结果为:

0 1 2 3 4

Java 实例 Java 实例

  • #0

  •