Guys i'm doing my java work and stuck at validation part.
It's to check that the user enters correct information. Like to input their phone number at the telephone fields.

Can any of you help me with the codes?
thanks.:)

No codes; you have to do that yourself. A telephone number is a sequence of digits but it isn't a number, e.g. 0317153 ... start with a zero, no actual number does but a telephone number can. Keep the telephone number as a String (that only contains digits). So basically you have to test a String for containing just digits (at least one digit?).

There are several ways to do it, starting from a simple loop that checks each character in the String (also read the API documentation of the Character class) ending with regular expressions that can do the entire job for you.

"^\\d+$" means match the string starting from the beginning, find one or more digits till the end of the line. There are also other boundary matchers like \A , \z etc you can take a look at the Pattern class documentation. Of course, the above is simplistic case of a phone number. Depending on what your requirements are , the regex will be more that just checking for all digits.

If it's a test I suspect simply confirming it's numbers is going to be more than enough. If it's the real world then you are quite correct. We don't know though.

The point is, they asked for code without providing any themselves. The general technique is to get them to actually do some work first to at least show willing on their part then start providing help. Throwing code at code requests is rarely a good idea.