ermm,i want to noe the code for reading in the first alphabet as
a input only.
eg: NAME den take in N only....help me?...lol..
Assuming you already know how to get input using the Scanner
class, just chain the charAt() method after calling the next()
method.
http://forums.macrumors.com/showthread.php?t=148798#post_message_1729620
More information about the charAt() method here.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#charAt(int)
Basically, what you are doing here is, when you call the next()
method, it returns a String object which contains the input from
the user (it's actually a token of the user input
but we won't talk about it here). The charAt() method, coming from
the String class, allows you to pick a character out of a String
object. Say, for example, a user types in "sgForums" as input. If I
want to retrieve the 3rd letter 'F', the offset of the letter would
be 2 (skip 2 letters), thus I would call next().charAt(2) from a
Scanner object.
If you don't understand any part of my post, please don't
hesitate to clarify with me.