“assert” in java [closed]

kriezo

New Member
\[quote\] Possible Duplicate:
What does assert do? \[/quote\]What is "assert"? What for is "assert" key-word used for? When and where can it be useful?This is an example of method from red-black tree implementation:\[code\]public Node<K,V> grandparent() { assert parent != null; // Not the root node assert parent.parent != null; // Not child of root return parent.parent;}\[/code\]i don't know what for "assert" is used in this code. Can't we type this code in some other way, with - for example - "if's" instead?
 
Top