java runtime error

一只红烧虾 2019-12-08 11:56:26
runtime error 是什么错误?超时吗?怎么修改代码呀?题目在图片中
...全文
186 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
亦夜 2019-12-08
  • 打赏
  • 举报
回复
运行时错误,代码在运行的过程中出现了错误,如果你是想知道这道题的代码怎么写,百度一大堆,不过那样没有意义,你可以一般般分析你的代码哪一步存在逻辑问题
一只红烧虾 2019-12-08
  • 打赏
  • 举报
回复
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); int[][] a=new int[2][7]; int[] sum=new int[7]; for(int i=0;i<a.length;i++){ for(int j=0;j<a[i].length;i++){ a[i][j]=input.nextInt(); sum[i]=a[i][j]+a[i+1][j+1]; } } boolean c=false; for(int f=0;f<7;f++){ if(sum[f]>8) c=true; } if(c) { double max=sum[0]; for(int z=0;z<sum.length;z++) { if(sum[z]>max) max=sum[z]; } System.out.println(max); } else System.out.println("0"); } } 这是我写的代码

62,621

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧