In java how to prompt the user to enter the phone number (xxx- xxx- xxxx) format in dialog box?

and take the number and Display it in (xxx xxx xxxx) instead of dashes i want spaces.
how do i do it?

I try to enter the number but it wont display.
i am taking programing one so please help me with basics.
thank you

If you read it in as a string, and then use substring() and charAt() methods to isolate certain strings and characters, then you can just confirm that the 3 substrings are integers and the 2 characters at the designated points are '-'. If this is the case then you can print substring1 + " " + substring2 + " " + substring3, and otherwise you loop back to the top and request user input again. Look at the String API for more assistance.