java.lang.string.getChars()

getChars() method in Java

java.lang.string.getChars()

getChars() method in Java used to copy the content of the String according to given parameters. The getChars() method takes 4 parameters

1.strBegin
2.strEnd
3.dst and
4.dstBegin

a Simple example...

public static void main(String[] args){
String str = "How are you.";
char[] arr = new char[7];
str.getChars(2, 9, arr, 0);
System.out.print("The Character array equals: ");
System.out.println(arr);
}

the Output is:
The Character array equals: w are y

Description of the getChars() example