Java String getChars()The java string getChars() method copies the content of this string into specified char array. There are 4 arguments passed in getChars() method. The signature of getChars() method is given below: Internal implementationSignatureThe signature or syntax of string getChars() method is given below: ReturnsIt doesn't return any value. ThrowsIt throws StringIndexOutOfBoundsException if beginIndex is greater than endIndex. Java String getChars() method exampleOutput: w3cschoool Java String getChars() Method Example 2It throws an exception if index value exceeds array range. Let's see an example. Output: java.lang.StringIndexOutOfBoundsException: offset 10, count 14, length 20 Next TopicJava String indexOf()
|