Help us understand the problem. What is going on with this article?


More than 1 year has passed since last update.
package JavaStudy;
//配列の練習 配列と合計

public class ArrayPractice {

    public static void main(String[] args) {

        int[]Math = {45,68,97,35,44,61,0,25,97,11,100};
        int[]English = {54,79,12,65,67,59,43,81,5,98,41,20};
        int[]Science = {64,38,73,49,35,71,10,21,55,71};

        int result1 = resultAverage(Math,resultSum(Math));
        int result2 = resultAverage(English,resultSum(English));
        int result3 = resultAverage(Science,resultSum(Science));


    public static void printResult(int[]subject,int average) {
        System.out.println("Average score is "+ average);
        System.out.println("There are "+ subject.length +" students");

    public static int resultSum(int[]subject) {
        int sum = 0;
        for(int i =0;i < subject.length;i++) {
            sum = sum + subject[i];
        return sum;

    public static int resultAverage(int[]subject,int resultSum) {
        int average = 0;
        average = resultSum/subject.length;
        return average;

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away