Look at the API doc for the String class. It has a method that will give you the length.how will i test the length
Define what you mean by a character? The only data that can be entered easily via the keyboard is a character. Look at the Character class's methods if you want to know what kind of character was read into the program.how will it confirm that the input is not a character?
The API doc: Java Platform SE 7