Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » Java与OOP初步  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 来报道了,顺便带了个小程序,请大虾看看
zhoujianghost





发贴: 1
积分: 0
于 2009-01-22 15:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我是一名JAVA初学者是自学,经朋友推荐买了本《JAVA编程基础、应用与实例》一个韩国人 徐明浩 写 武传海 翻译成中文讲得很详细。好像和论坛钟所说的那本白色封面的书差不多。封面也是白色的。好了直接上程序
package lianxi;

public class Shere {

  /**
   * @param args
   */
  public static void main(String[] args) {
   String a="国语:90",b="英语:80",c="数学:70";
   int a1=90;
   int a2=80;
   int a3=70;
   int b1=a1+a2+a3;
   int c1=b1/3;
   System.out.println(a+b+c);
   System.out.println("总分:"+b1);
   System.out.println("平均分"+c1);
   System.out.println((c1<70)&&(c1>70)?"普通":"优秀");
   /* 80<70 80>70 true :false
   false true
   false 优秀*/
  
  
  }

}
结果应该有个批注:优秀
可小弟不知道该加到哪里,请大虾指教。
在这先谢过了


zhoujianghost edited on 2009-01-22 15:48

作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:zhoujianghost]
九佰



版主


发贴: 983
积分: 126
于 2009-01-23 17:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
(c1<70)&&(c1>70) 的结果始终是 false

c1<70 并且 c1>70 ,满足这个条件的c1不存在。

平均成绩小于70 为普通,大于等于70为优秀
System.out.println(c1<70?"普通":"优秀");




http://www.teamlet.org

海纳百川,有容乃大
壁立千仞,无欲则刚
智者不惑,勇者无惧
止戈为武,仁者无敌
作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:zhoujianghost]
xiaowenhuman





发贴: 2
积分: 0
于 2009-04-11 20:24 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你上传的程序的运行结果如图
有个优秀啊!



作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:zhoujianghost]
wuanfo





发贴: 5
积分: 0
于 2009-04-13 10:07 user profilesend a private message to usersend email to wuanfosearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
晕,这种问题就不用提了吧


作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:zhoujianghost]
JiafanZhou



版主


发贴: 736
积分: 61
于 2009-04-20 17:39 user profilesend a private message to usersend email to JiafanZhousearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
(c1<70)&&(c1>70) is an obvious mistake. It is like telling others "I want a c1 less than 70 and meanwhile c1 must be greater than 70"

Jiafan



When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:zhoujianghost]
zhrllx001





发贴: 1
积分: 0
于 2009-04-21 02:29 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你的调教判断语句永远为FALSE
因为逻辑与,要两个真才是真。
这种判断应该if~else
语句分开判断的



作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:zhoujianghost]
yhl27





发贴: 6
积分: 0
于 2009-04-21 22:43 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
顶!


作者 Re:来报道了,顺便带了个小程序,请大虾看看 [Re:xiaowenhuman]
careson919





发贴: 2
积分: 0
于 2009-07-06 10:55 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
xiaowenhuman wrote:
你上传的程序的运行结果如图
有个优秀啊!


大哥,不要害人家啊,他那个程序?:的条件是错的
不管分数是不是大于80,都会有个优秀!!!




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923