fork download
  1. class Test{
  2. public static void main(String[] args){
  3. int [][] score = {{64, 98, 65, 99, 98}, {81, 79, 78, 99, 98}, {45, 88, 89, 99, 98}, {81, 73, 78, 99, 98}};
  4. int[] min = new int[score[0].length];
  5.  
  6. for(int j = 0; j < score[j].length; j++){
  7. min[j] = score[0][j];
  8.  
  9. for(int i = 0; i < score.length; i++){
  10. if(min[j] > score[i][j]){
  11. min[j] = score[i][j];
  12. }
  13. }
  14. }
  15.  
  16. for(int j=0; j<score[0].length; j++){
  17. System.out.println((j+1)+"回目のテストの最低点:"+min[j]+"点");
  18. }
  19. }
  20. }
Runtime error #stdin #stdout #stderr 0.09s 27760KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
	at Test.main(Main.java:6)