Question Index

Write a program to get the list of qualified students. Students with marks greater than or equal to 35 are considered qualified.

Input (List) Output (List)
[Mahesh-80, Rajesh-25, Suresh-75, Ramesh-35] [Mahesh-80, Suresh-75, Ramesh-35]
[Mahesh-80, Rajesh-90, Suresh-75, Ramesh-35] [Mahesh-80, Rajesh-90, Suresh-75, Ramesh-35]
[Mahesh-21, Rajesh-25, Suresh-75, Ramesh-34] [Suresh-75]
[Mahesh-21, Rajesh-25] []

import java.util.ArrayList;
import java.util.List;

class QualifiedStudents
    public static void main(String s[])
        List<Student> list = new ArrayList<Student>();
        list.add(new Student("Mahesh", 80));
        list.add(new Student("Rajesh", 25));
        list.add(new Student("Suresh", 75));
        list.add(new Student("Ramesh", 35));
        List<Student> qualified = getQualifiedStudents(list);
        System.out.println("Qualified students are " + qualified);


    public static List<Student> getQualifiedStudents(List<Student> allStudents) {

class Student {

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

    public String toString() {
        return name + "-" + marks;



Topic: Java ArrayList

Read this topic
Take test on this topic

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App