leetcode

一、String.toCharArray数据转换成字符数组
public static void main(String args[])
{
String s1 = "This ";
char [] ch = s1.toCharArray();
System.out.println(ch);
}

二、Arrays.fill填充数组中的每个元素都是value
boolean[] a1 = new boolean[5];
Arrays.fill( a1,true );
结果 a1[] = {true,true,true,true,true};

String[] a9 = new String[6];
Arrays.fill(a9, "Hello");
Arrays.fill(a9, 3, 5,"World");
结果是 a9[] = {Hello,Hello,Hello,World,World,Hello};

你可能感兴趣的:(leetcode)