Java String(char[] value, int offset, int count) Constructor
Syntax
String(char[] value, int offset, int count) constructor from String has the following syntax.
public String(char[] value, int offset, int count)
Example
In the following code shows how to use String.String(char[] value, int offset, int count) constructor.
public class Main {
public static void main(String args[]) {
/* ww w . j a va2 s .co m*/
char charArray[] = { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o','m' };
String s4 = new String(charArray, 6, 3);
System.out.println(s4);
}
}
The code above generates the following result.