Question 13
Consider the Java code given below.
class Triangle{ private double base, height; // Constructor Triangle(double b, double h) to initialize base, height public double getArea() { assert base > 0; //LINE 1 assert height > 0; //LINE 2 double area = 0.5 * base * height; assert area > 0; //LINE 3 return area; }}public class AssertionTest { public static void main(String[] args) { Triangle obj = new Triangle(3.0, -4.0); System.out.println(obj.getArea()); }}Choose the correct option when the program is executed as:
java -ea AssertionTest