Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Java Question

  1. Feb 13, 2006 #1


    User Avatar
    Homework Helper
    Gold Member

    I need java to read a string and count how many characters are in it. I know theres some class that can do this. What is it?
  2. jcsd
  3. Feb 13, 2006 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    "Read a string?" From standard input?

    Use e.g.

    String s = System.in.readLine();
    int n = s.length();

    - Warren
  4. Feb 14, 2006 #3


    User Avatar
    Homework Helper
    Gold Member

    Thanks alot.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Java Question
  1. Java question (Replies: 5)

  2. Java Question (Replies: 2)

  3. Java Question (Replies: 3)

  4. Question about Java (Replies: 4)