Menu
Question Index
...

Write a program to find the Student with highest marks out of the 3 students passed as parameters.



class FindStudentWithHighestMarks
{
    public static void main(String s[])
    {
        Student munnu = new Student("Munnu", 72);
        Student satish = new Student("Satish", 88);
        Student sreekanth = new Student("Sreekanth", 89);
        
        Student topper = getStudentWithHighestMarks(munnu, satish, sreekanth);
        
        System.out.println("The topper is " + topper.name);

    }


    public static Student getStudentWithHighestMarks(Student s1, Student s2, Student s3)
    {
    }

}
class Student
{
    String name;
    int marks;

    Student(String name, int marks)
    {
        this.name = name;
        this.marks = marks;
    }
}

Doubts

Problems

Topic: this Keyword 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