weixin_44724976 2019-05-16 17:42 采纳率: 0%
浏览 283

上星期写的一个代码写完后运行可以出东西今天再运行控制台就不输出东西

运行其他的代码都能输出东西只有他不行
package ev10;
import java.util.Scanner;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.InputMismatchException;
import java.lang.String;public class Outperformance {
String []a= {"张三","李四","狗子","翠花","狗蛋"};
public void Out() throws IOException
{
try
{
FileOutputStream f=new FileOutputStream("data.txt");
Scanner in1=new Scanner(System.in);
int b[]=new int[5];
for(int j=0;j {
b[j]=in1.nextInt();
if(0>=b[j]||b[j]>=100)
{
throw new Findexpection("成绩不能小于0也不能大于100!");
}
}
for(int i=0;i<a.length;i++)
{
System.out.println("姓名为"+a[i]+"的同学的成绩为"+b[i]);
f.write(b[i]);
}
f.close();

     }
     catch(InputMismatchException e)
        {
            System.err.println("输入的不为整数");
            e.printStackTrace();
        }
     catch(Findexpection e)
        {
            System.err.println(e.getMessage());
        }
 }
 public static void main(String[] args) throws IOException  {
        // TODO Auto-generated method stub
     Outperformance o=new Outperformance();
     o.Out();
     System.out.print("456");

    }

}
将o.O去掉就能输出456不去掉就什么都没有

  • 写回答

3条回答 默认 最新

  • Hefei19881002 2019-05-16 17:45
    关注

    o.Out(); 异常了 你这是throws的 所以看不到异常信息 把throws 换成 try{}catch 输出下异常信息看看啥情况

    评论

报告相同问题?

悬赏问题

  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?