View RSS Feed

Java String

String Length

Rate this Entry
by , 04-26-2012 at 07:26 PM (386 Views)
An objectís information is seeked by certain methods and those methods are named as accessor methods. Among them, one that could be used along with strings is known as length() method that would be returning no. of characters present in string object.
Java Code:
public class StringDemo{
   public static void main(String args[]){
      String palindrome = "Dot saw I was Tod";
      int len = palindrome.length();
      System.out.println( "String Length is : " + len );
Result would be:
String Length is : 17

Submit "String Length" to Facebook Submit "String Length" to Digg Submit "String Length" to Submit "String Length" to StumbleUpon Submit "String Length" to Google