Code for Exception in Java
Can someone help me to write a code for an exception in Java. No problem if there is no detailed coding about the exception, just few lines will be OK, so I can understand the logic of it. Lets assume that I have got my main function. In that I am asking the user to input their First Name. Now I want an exception saying that "You have to enter the name" or "You have entered a number as your name, type properly" when the user has entered nothing or the user has entered the number in the Name field. Also can I handle the exceptions in the other class.?? So that it gets triggered when such scene occurs. Can someone help me..??
Desktop * Athlon X2 4200 | 2048M RAM | 160G HD | 7600GT
MacMini * G4 1.33GHz | 512M RAM | 40G HD | Radeon 9200
Laptop * Sempron 2800 | 512M RAM | 60G HD
PDA * Dell Axim x51 | 128M Internal | 256M SD Card
Bookmarks