开发者社区> 问答> 正文

新手提问 java 程序无报错 运行不了 ?报错

main方法也有啊 程序无报错 就是运行无反应
是逻辑错误吗?图片说明

展开
收起
爱吃鱼的程序员 2020-06-23 20:46:21 521 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
    /*packagewhatever;//don'tplacepackagename!*/importjava.util.*;importjava.lang.*;importjava.io.*;/*Nameoftheclasshastobe"Main"onlyiftheclassispublic.*/classChaxun{publicstaticvoidmain(String[]args)throwsjava.lang.Exception{//yourcodegoeshereScannersc=newScanner(System.in);ints=sc.nextInt();Chaxuncx=newChaxun();intgrade=cx.compare(s);if(grade==1){System.out.println("A");}elseif(grade==2){System.out.println("B");}elseif(grade==3){System.out.println("B");}}publicintcompare(ints){returns>90?1:(s>60?2:3);}}

    http://ideone.com/izD16K
    在线编译运行
    输入
    64
    输出
    B

    老哥,它在等你输入。

    你输入的是什么

    returns>90?1:(s>60?2:3);

    加上括号

    第三行的System.out.println("B");修改为System.out.println("C");

    2020-06-23 20:46:36
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载