Fill Elements in an Array: char type in Java
Description
The following code shows how to fill Elements in an Array: char type.
Example
// w w w . jav a2s . co m
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
char[] charArr = new char[10];
char charFillValue = 'c';
Arrays.fill(charArr, charFillValue);
System.out.println(Arrays.toString(charArr));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »