| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 815 人关注过本帖
标题:麻烦帮我解释一下
取消只看楼主 加入收藏
pine
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2004-8-10
收藏
 问题点数:0 回复次数:0 
麻烦帮我解释一下

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是什么意思?在做题碰到好多这样的题,好郁闷。。。。。麻烦高手帮帮忙解释一下,谢谢

搜索更多相关主题的帖子: 麻烦 解释 
2004-08-28 18:59
快速回复:麻烦帮我解释一下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.055688 second(s), 10 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved