About Question com.enthuware.ets.scjp.v6.2.222 :
Posted: Fri Jun 15, 2012 3:50 am
public class TestClass
{
public static void main(String[] args)
{
assert args.length == 2 : "Must give two arguments";
...
}
}
right answer "The programmer should throw a RuntimeException instead of using an assertion in this case"
I choosed "This is an appropriate use of assertions."
Weird... the book state
Don't Use Assertions to Validate Command-Line Arguments
Don't Use Assertions to Validate Arguments to a Public Method
{
public static void main(String[] args)
{
assert args.length == 2 : "Must give two arguments";
...
}
}
right answer "The programmer should throw a RuntimeException instead of using an assertion in this case"
I choosed "This is an appropriate use of assertions."
Weird... the book state
Don't Use Assertions to Validate Command-Line Arguments
Don't Use Assertions to Validate Arguments to a Public Method