Monday, 2 September 2013

Java Program find string length from user input

Java Program find string length from user input

import java.util.*;
public class Strings {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word1 = sc.next();
System.out.println(word1.length());
sc.close();
}
}
So i want to make a very simple program that takes in a user string and
returns the length, but the program does not even run. I am using eclipse.
Any tips?

No comments:

Post a Comment