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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Java Question Date
Java A few questions about java Jan 10, 2017
Java Probably very easy question about isNaN() java Jan 10, 2017
C/++/# Question about learning C++ Linked Lists before Stacks... Oct 6, 2016
Java Junior Java Interview Questions -- What to Expect? May 6, 2015
Java Question about Java Jan 17, 2015