what is the difference between java assert and if () {} else exit;?
can i just use if () {} else exit instead of assert ?
解决方案
A bit of google maybe ?
" The main thing you should keep in mind is that the if-else statement should be used for program flow control and the assert keyword should only be used for testing purposes. You should never use asserts to actually perform any operation required for your application to work properly.
According to Sun's official Java documentation: "Each assertion contains a boolean expression that you believe will be true when the assertion executes." "