what will happen when you attempt to compile and run the following code?
(assume that the code is compiled and run with assertions enabled)
public class AssertTest
{
public static void main(String args[])
{
float f1 = Float.NaN;
float f2 = f1;
float f3 = 1.2f;
try
{
assert(f2 == f1):f2= 2;
f3 = 1.5f;
}catch(AssertionError ae)
{
f3++;
}
f3 += f2;
System.out.println("f3 = " + f3);
}
}
A. compilation error at line 5
B.compilation error at line 7
C.It will print- f3 = 3.5
D.It will print- f3 = 4.2
E.It will print- f3 = NaN
在上面的assert(f2 == f1) : f2 = 2;中间的:不明白是什么意思。怎么解释这句话?还有NaN是什么意思?在做题碰到好多这样的题,好郁闷。。。。。麻烦高手帮帮忙解释一下,谢谢