问题 问答题

下面的程序是从命令行输入3个数传递到public static void main(String args[])方法中(如java Is Triangle 3 4 5),并判断这3个数能否构成三角形的3条边,并显示相应的结果。请在程序的每条横线处填入适当的语句,使程序的功能完整。
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class IsTriangle
public static void main(String args[ ] )
int a[ ]=new______________ [args.length];
for(int i=0;i<args.length;i++)

a[i] = ____________________

if(_________________)
System.out.println(a[0]+ ","+a[1]+ ","+a[2] "能构成三角形的3条边");
else
System.out.println(a[0]+ ","+a[1]+ ","+a[2] "不能构成三角形的3条边");

答案

参考答案:
int
Integer.parseInt(args[i]);
a[0]+a[1]>a[2]&&a[1]+a[2]>a[0]&&a[2]+a[0]>a[1]

解析:
本题主要考查从系统命名行传递参数、for循环语句和逻辑运算符的知识点。解答本题的关键是熟练掌握从系统命名行传递参数、for循环语句和逻辑运算符的知识。对于逻辑运算符&&,如果左边表达式的值为false,则不会再对运算符右边的表达式求值,整个布尔逻辑表达式的结果已确定为false。例if(expressionl &&expression2&&expressio)expression1,expression2和expression中,只要有一个值为false则整个表达式的值为false。在本题中,int a[]=new int[args.length];语句的功能是创建整型数组a,a[i]=Integer.parseInt(args[i]);语句的功能是把从系统命令行获得的数据转换成基本整型数据,赋值给数组元素 if(a[0]+a[1]>a[2]&&a[1]+a[2]>a[0]&&a[2]+a[0]>a[1])语句的功能是判断从系统命令行获得的3个数能否构成三角形。

完形填空
People always say that if God closed a door in front of you, there must be a window opened for you. Yes, people always say that, but  31  is the window for me?
I’m not disappointed, just a little worried  32  as my roommate said, “Why are you angry with yourself once you  33  to do anything?” I had no idea. I just can’t  34  myself if I can understand some easy things. Now, I just feel  35  with myself because I couldn’t finish the assignment(任务) on the lab, and what was  36  worse was that actually I didn’t understand what the  37  was! Fiona asked me why I didn’t  38  for help. The problem is that if I have to ask some silly questions, I will feel  39 .
Before I came here, I was confident. But I have totally  40  it. Sometimes I can’t even find the right words: sometimes I am too shy to  41  others. I have to admit that I am  42 .
The wisest people are always  43  who can take advantage of others’ wisdom. But I was so stupid as to close myself and  44  a lot of time soaking inside the workbook,  45  made me more confused. Why can’t I follow the sentence? I am  46  to get help the next time I have any questions. I can  47  I am not smart, But I shouldn’t hide it. I must  48  it as soon as possible. 49  I will have to waste much more time on it ---just like tonight.
Difficulties always go with me. Go  50  ! I can make it.
小题1:
A.whichB.what C.whereD.why
小题2:
A.or B.andC.butD.while
小题3:
A.wantB.decideC.failD.like
小题4:
A.believe B.like C.delightD.forgive
小题5:
A.unsatisfied B.satisfiedC.happy D.worry
小题6:
A.veryB.evenC.quiteD.fairly
小题7:
A.lab B.assignmentC.problemD.question
小题8:
A.lookB.thankC.searchD.ask
小题9:
A.shamedB.upsetC.comfortableD.sorry
小题10:
A.forgotB.made C.lostD.took
小题11:
A.disturbB.helpC.greet D.communicate
小题12:
A.smart B.cleverC.wrongD.stupid
小题13:
A.theseB.thoseC.ones D.the ones
小题14:
A.spendB.costC.killD.waste
小题15:
A.thatB.whatC.whichD.as
小题16:
A.determinedB.willingC.contentD.ready
小题17:
A.sayB.announceC.explainD.admit
小题18:
A.answerB.solveC.work outD.finish
小题19:
A.HoweverB.ThusC.OtherwiseD.Hopefully
小题20:
A.aheadB.onC.downD.up
多项选择题