I am trying to count the length of the name that the user inputs using an additional method. When I try to access the user input "ipnut from my method it has an error. What is wrong with my 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 input = reader.nextLine();
calculateCharecters(text);
}
public static int calculateCharecters(String text){
int texts = input.length();
System.out.println("Number of charecters: " + texts);
return texts;
}
}