Hi,
can I use the if statement in try block in HW 1007 to test the number is 0
or less than 0 and then throw exception?
If not , then any hint please?
Thanks SzopeN, for your help.
On Tue, Oct 28, 2008 at 3:34 PM, Antara Pal <[EMAIL PROTECTED]> wrote:
> 6. For your own exercise, modify Diamond.java so that the a number that
> is greater than 20 generates AssertionError
>
>
> Modified CODE for AssertExample ( *the problem is that it does
> not display the second block of statement while run, can anyone tell me the
> right thing?*)
> modified code:
>
> try{
> assert(size < 20);
> printDiamond(size);
> }catch(AssertionError c){
> JOptionPane.showMessageDialog(null,"Assertion error is
> captured:Size should be<20");
> }
> System.exit(0);
> try{
> assert(size > 0);
> printDiamond(size);
> }catch(AssertionError e){
> JOptionPane.showMessageDialog(null,"Assertion error is
> captured: Size should be >0");
> }
>
>
> Thanks in advance.
> Antara
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---