Kajsa
Kajsa

Reputation: 1

To make a new method in a class in Java

Hey guys! I'm new to Java, and I want to make a new class called Student. Now I want every student to have their own grade array. My question is: how do I make a method setGradeArray in the class Student? Thanks a lot!

Upvotes: 0

Views: 4612

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038800

public class Student
{
    private int[] gradeArray;
    public void setGradeArray(int[] value)
    {
        this.gradeArray = value;
    }
}

Upvotes: 2

Related Questions