title: Get length of string method Java
body: <p>I need to do this:
  Create a program that asks for the user's name and says how many characters the name contains.
  Your program should be structured so that you put the calculating of the name length in it's own method: public static int calculateCharacters(String text). The tests will be testing both the method calculateCharacters and the program overall.</p>
  
  <p>I know how to count the characters in a string. I just can't figure out how to do this when I have to use a seperate method. Can someone please help me?</p>
  
  <pre><code>import java.util.Scanner;
  
  public class LengthOfName {
  public static void main(String[] args) {
      Scanner reader = new Scanner(System.in);
      System.out.println("Type your name: ");
      String name = reader.nextLine ();
      int cal = calculateCharacters(name);
      System.out.println(Number of characters: " + cal);
  
  }
  
  
  public static int calculateCharacters(String text) {
      int cal = text.length ();
      //System.out.println("Number of characters: " + count ());
      return cal;`
  </code></pre>