Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. public class ZipCode {
  2.  
  3. public static String from(String zipCode) {
  4. if (zipCode.length() != 5) {
  5. throw new InvalidZipCodeException();
  6. }
  7. try {
  8. int parsedZip = Integer.parseInt(zipCode);
  9. } catch (NumberFormatException numberException) {
  10. throw new InvalidZipCodeException();
  11. }
  12. return zipCode;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement