In this section, you will learn how to use length() method of the String class. We are going to using length() method. These method are illustration as follow here:
Description of program:
Here, we will know that how many character of length in String. First of all, we have to define class named "StringLength". Inside of class we have to define method of class in main class. After that we create one method which returns the integer type values. So we are using to length() method of the String class for the purpose.
length() method : This method return the length of this string as an integer value.
Here is the the code of this program:
Output this program:
Eneter string value:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 5, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles