I’m taking a Java assessment test. I do not understand the use of the colon in the command line. Could someone please elaborate? Thanks.
Here is the question…
Given:
class One {
int x = 0;
{assert x == 1;}
}
public class Two {
public static void main(String[] args) {
int y = 0;
assert y == 0;
if(args.length > 0)
new One();
}
}
Which of the following will run without error? (Choose all that apply.)
A. java Two B. java Two x C. java -ea Two D. java -ea Two x E. java -ea:One Two F. java -ea:One Two x G. java -ea:Two Two x
The
-eais a command line argument to enables assertions. If you give a class after the -ea, it is enabled just for the classes listed. e.g.-ea:Oneturns on assertions for classOne