how can i scan a character from scannner class( just like int-nextInt,Boolean-nextBoolean)

Well, is there a nextCharacter method? No? Then what about simply using next and then toCharArray on the resulting String?

tanx.can you explain little bit more using a example

String aLine = scannner.nextLine(); // read the next line (test with hasNext() first?)
char aChar = aLine.charAt(0); // get the first character

tanx.can you explain little bit more using a example

I'm sorry, but why didn't you take the clues you'd been given, look at the API docs, and see if you could come up with something. It's usually a bit more satisfying that way, and definately more instructional and useful.

Hi friends,
there is another way to scan a single char from keyboard.
since there is no short way like nextInt();

the only solution is:
char aChar;
aChar = input.next().charAt(0);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.