Advertisement
Guest User

Untitled

a guest
May 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LengthOfName {
  4. public static void main(String[] args) {
  5. Scanner reader = new Scanner(System.in);
  6.  
  7. System.out.print("Type your name: ");
  8. String text = reader.nextLine();
  9. System.out.println("Number of characters: " + calculateCharacters(text));
  10. }
  11.  
  12. // do here the method
  13. public static int calculateCharacters(String text){
  14.  
  15. return text.length(text);
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement