Discussion
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.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development