Menu
Question Index
...

Write code to update the total marks of the student. A student object is passed for which the marks of different subjects are initialized.



class UpdateStudentTotalMarks
{
    public static void main(String s[])
    {
        Student student1 = new Student();
        student1.subject1 = 57;
        student1.subject2 = 84;
        student1.subject3 = 93;
        student1.subject4 = 76;
        
        updateStudentTotalMarks(student1);
        
        System.out.println("The total marks of the student are " + student1.total );

    }


    public static void updateStudentTotalMarks(Student student)
    {
    }

}
class Student
{
    int subject1;
    int subject2;
    int subject3;
    int subject4;
    int total;
}

Doubts

Problems

Topic: Member Variable In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App