In severe cases local programs may be executed or Java security disabled.
These bugs can potentially be used to turn the machine into a zombie computer, steal confidential data from machine and intranet, spy through attached devices, prevent useful operation of the machine, assist further attacks, and many other malicious activities.
I have imported a Scanner method, and sent out for the user ti imput a social security number.
Scanner (click on the class name to go to the Java Docs) You can specify the delimiter as a "-" and get 3 ints from it.
Then you can check the values if they each fall within the appropriate ranges. Practice only makes habit, only perfect practice makes perfect. Practice doing the right things and doing things right.
@lawtonhself This is the best solution, but it doesn't quite fit the specification the you gave (which sounds like a homework problem). If you ever have to determine if a string is a SSN in production code, this is what you'd use.
On the other hand, if you want to get to writing production code, you gotta start with the basics. Of course using a regex is the way to go, but given that this is an assignment and it sounds like they want you to do it manually, this is probably what they're looking for.
In this java regex tutorial, we will learn to use regular expressions to test whether a user has entered a valid Social Security number in your application or website form.