Java - Assign value to Array and Convert Array to List

Description

Assign value to Array and Convert Array to List

Demo

import java.util.Arrays;

public class array {
  public static void main(String[] args) {
    int[] arr;/*from w w  w  .j av  a 2  s .c  o  m*/
    String[] strings = new String[10];
    arr = new int[10];
    System.out.println(arr.length);

    arr[0] = 4;
    arr[1] = arr[0] + 5;

    int[] arr2 = { 1, 2, 3, 4, 5 };

    for (int i = 0; i < 10; i++) {
      strings[i] = Integer.toString(i);
    }

    if (Arrays.asList(strings).contains("11"))
      System.out.println("Array has it!");
  }
}

Related Topic