The program is run with java -ea:com.acme.util... com.acme.util.Fragment30 - what will be the output?
package com.acme.util;
public class Fragment30
{
public static void main(String[] args)
{
assert false;
System.out.println("ran");
}
}
Answer: B
The trailing three dots mean the named package and all of its subpackages. Fragment30 is in com.acme.util, so assertions are enabled for it, the false assertion is evaluated and an AssertionError is thrown before the print. Without the dots the switch would name a class rather than a package.
Please log in or register to report this question.