Add multiple String variables to ArrayList

前端 未结 6 2090
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 18:24

Suppose I have a lot of String Variables(100 for example):

   String str1 = \"abc\";
    String str2 = \"123\";
    String str3 = \"aaa\";
....
    String st         


        
6条回答
  •  孤城傲影
    2021-01-14 18:59

    If you are using Java 9 then easily you can add the multiple String Objects into Array List Like

    List strings = List.of("abc","123","zzz");
    

提交回复
热议问题