| Author |
assertion
|
meena latha
Ranch Hand
Joined: Jan 24, 2005
Posts: 219
|
|
public class Test { public void foo() { assert false; assert false; } public void bar() { while(true) { assert false; } assert false;//line 1 } } This program generates a compile error.Can anybody explain this to me. It will be appreciated if you provide me a link to know about assertion.
|
 |
Jay Pawar
Ranch Hand
Joined: Aug 27, 2004
Posts: 411
|
|
Line 1 is unreachable because the compiler detects the endless while loop. Hence you get unreachable statement error.
|
Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
|
 |
ganesh subbiah
Ranch Hand
Joined: Nov 18, 2004
Posts: 39
|
|
Hi Ramya This link may help you http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
|
 |
meena latha
Ranch Hand
Joined: Jan 24, 2005
Posts: 219
|
|
i didnt realize that....Thanks Jay. Any links to know more about assert statements. Thanks in advance.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: assertion
|
|
|