Dear Miga
 
>  But when the negative number is very large like -2738484349093093204 this 
>throws a numberformatexcept and ignores mynegativeexception.  This is too 
>large for memory.  Do I fix this or leave like this? 


For your future coding, it is better to fix it, you may catch it, for 
example, within printDiamond, giving the size an upper limit and 
throwing here a RuntimeException (I put 20 as limit here). 
 
----------------------------------------------------------------------------------------------
QUESTION: (above statement)
aa) I catch number larger than 20 but can not catch number less than 
-999,999,999. or greater than 999,999,999.  NumberFormatException picks this 
up.  Problem is that number is no longer integer.  How to override?
----------------------------------------------------------------------------------------------

In the try block: 
1 - you define the size 
2 - you assert it positive 
3 - you test if negative and throw your negative exception inside the 
if block 

In the catch block: . . .
2 - you catch the assertion error
 
----------------------------------------------------------------------------------------------
QUESTION: (above statement)
bb) Not too sure why I need to assert positive when if statement test condition 
for negative number?  
----------------------------------------------------------------------------------------------

 


 
Respects,

JKid314159
http://existentialists.blogspot.com/
 


      
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to