Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class LengthOfName {
- public static void main(String[] args) {
- Scanner reader = new Scanner(System.in);
- System.out.print("Type your name: ");
- String text = reader.nextLine();
- System.out.println("Number of characters: " + calculateCharacters(text));
- }
- // do here the method
- public static int calculateCharacters(String text){
- return text.length(text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement