| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1108 人关注过本帖
标题:请教: IF(){}ELSE{}的问题
取消只看楼主 加入收藏
yanhui007
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2005-12-27
结帖率:100%
收藏
 问题点数:0 回复次数:0 
请教: IF(){}ELSE{}的问题
本人对IF()}ELSE IF{}有一问题不清楚想请高手解释:
TreeNodeBase two;
if (organization2.getType().equalsIgnoreCase("department")) {
two = new TreeNodeBase("rootNode-link",
organization2.getName(), false);
} else if (organization2.getType().equalsIgnoreCase("subbranch")) {
two = new TreeNodeBase("rootNode", organization2.getName(), false);

} else {
two = new TreeNodeBase("rootNode-link2",organization2.getName(), false);
        }
two.setIdentifier(organization2.getOid().toString());

象上面的代码: TreeNodeBase two ;这样定义就可以了

但是如果条件变成
if (organization2.getType().equalsIgnoreCase("department")) {
two = new TreeNodeBase("rootNode-link",
organization2.getName(), false);
} else if (organization2.getType().equalsIgnoreCase("subbranch")) {
two = new TreeNodeBase("rootNode", organization2.getName(), false);

}

必须要初始化TreeNodeBase two =???

不知道为什么???
搜索更多相关主题的帖子: ELSE two TreeNodeBase false 
2008-02-04 13:59
快速回复:请教: IF(){}ELSE{}的问题
数据加载中...
 
   



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

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011074 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved