Question 9
Consider the Java code given below.
public class AssertTest{ public static double caltempDiff(double currentTemp, double idealTemp) { double tempdiff = 0; assert currentTemp >= -100 && currentTemp <= 150 ; // assert-1 assert idealTemp >= -100 && idealTemp <= 150 ; // assert-2 tempdiff = currentTemp - idealTemp; assert tempdiff >= 0 ; // assert-3 return tempdiff; }
public static void main(String[] args) { double currentTemp = 35.0; double idealTemp = 37.0; assert currentTemp >= -100 && currentTemp <= 150 ; // assert-4 double tempDifference =caltempDiff(currentTemp, idealTemp); }}Identify the first assert statement that throws the AssertionError when the class is executed as:
java -ea AssertTest