Results 1 to 4 of 4
  1. #1
    mansoorhacker is offline Member
    Join Date
    Nov 2008
    Posts
    2
    Rep Power
    0

    Default Help me to solve problem

    hi every body


    i want to know the code used behind the length() method in strings of java.

    actually i want to know how to find the string length without using the builtin lenght() method of strings in java.

    thx.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Why not have a look at the other methods available to String per its API, and then come back and let us know what you've found that can possibly help you.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by mansoorhacker View Post
    hi every body


    i want to know the code used behind the length() method in strings of java.

    actually i want to know how to find the string length without using the builtin lenght() method of strings in java.

    thx.
    Are you working on an IDE? If so you can easily see the source code for String class. Answers for the both your questions are there.

  4. #4
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    7

    Default

    The "length" method returns a private "count" variable that holds the length of the "String" object. Thus, unless you implement your own version of the "String" class, you won't be able to implement a practical "length" method.

    Google search returned the implementation of the String class:
    java.lang: String.java

Similar Threads

  1. Please solve the problem related to PDf reader
    By kavithaprabhaker in forum New To Java
    Replies: 5
    Last Post: 11-23-2011, 10:08 AM
  2. Help me to solve problem
    By mansoorhacker in forum Forum Guides
    Replies: 8
    Last Post: 01-24-2009, 06:29 PM
  3. JList and records, what to do to solve the problem
    By willemjav in forum Java Applets
    Replies: 10
    Last Post: 06-11-2008, 02:28 PM
  4. Help mi solve my error
    By Deon in forum New To Java
    Replies: 3
    Last Post: 01-11-2008, 05:26 AM
  5. Cannot solve the coding problem of my assignment
    By elimmom in forum New To Java
    Replies: 3
    Last Post: 08-13-2007, 11:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •