Java Arrays copy CharSequence array

Description

Java Arrays copy CharSequence array

import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    String[] sa = { "First", "Second", "Third", "demo2s.com" };
    CharSequence[] csa;// ww  w. jav a 2 s.  c  o m
    csa = Arrays.copyOf(sa, sa.length, CharSequence[].class);
    for (int i = 0; i < csa.length; i++)
      System.out.println(csa[i]);
  }
}



PreviousNext

Related