Java – initialize string array

Initialize string array using curly braces {}

public class Main {
  public static void main(String[] args) {
    String[] strArr = {"strA", "strB", "strC"};
    for (String str: strArr) {
      System.out.println(str);
    }
  }
}
OpenJDK 64-Bit Server VM warning: Insufficient space for shared memory file:
   7775
Try using the -Djava.io.tmpdir= option to select an alternate temp location.

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments