User Profile

Collapse

Profile Sidebar

Collapse
DHS1
DHS1
Last Activity: Dec 29 '08, 10:32 PM
Joined: Dec 28 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • DHS1
    replied to Exception handling help (newbie)
    in Java
    Ohh I finally see what you're saying. I should use the .getMessage() method to verify exactly which NumberFormatExc eption it threw.

    This is what I did and it works great. But is there a simpler way, or an alternative way you know of?

    Code:
    	public DateStringConverter(String startDate, String endDate ){
    		if((startDate==null)||(startDate.length()>10||startDate.length()<10)){
    			throw new NumberFormatException("startDate");
    ...
    See more | Go to post

    Leave a comment:


  • DHS1
    replied to Exception handling help (newbie)
    in Java
    Ok thanks. How would I specify the IAE for each separate problem? I mean, how can I catch one, and say it was because the string was null, and catch the other and say that it was because the string was the wrong length? Because if I do:

    catch(IllegalAr gumentException e) then i can't tell which problem made it throw the IAE. I need to tell the user whether they entered a null string, or a string of wrong length. and I need to know just...
    See more | Go to post

    Leave a comment:


  • DHS1
    started a topic Exception handling help (newbie)
    in Java

    Exception handling help (newbie)

    Hey guys. I have a lab that is due in two weeks, but I wanted to start on it now. Problem is, I'm at home during christmas break so I can't ask my professors. Here's my problem:

    I am given a very fragile program and I have to add the exception handling and error checking and pretty much make it uncrashable.

    I will show just one small step in this lab. If you can answer it, I think I'll be able to do the rest. I just...
    See more | Go to post
No activity results to display
Show More
Working...