This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by sweety singh: 2. can anyone give me an example for not using assertions to validate command line arguments.
Dunno what you mean by an example. I can give reasons, if that's what you mean.
Assertions are for checking internal assumptions and consistency of a program. The conditions checked by assertions should be ones that are always true, unless there is a bug in the program.
Assertions are not for checking user input, resource availability, I/O success etc. Remember that assertions are turned off in release code, so if they were used for such checks, the checks would not happen in release code.
Command-line arguments are user input. Bad command-line arguments are not a bug in the program that's reading them. Therefore assertions should not be used for checking them.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.