Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Tutorials Java StringExamples java.lang.string.getChars()

Related Tutorials


 
 

Share on Google+Share on Google+

java.lang.string.getChars()

Advertisement
getChars() method in Java

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

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 17, 2005

Related Tutorials

Discuss: java.lang.string.getChars()  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com