V
Vinsoft Lab
Learn • Build • Grow
Programming Intermediate Paid

Java Programming

Learn Java programming from the fundamentals to object-oriented programming, collections, exception handling and practical application development.

8 Weeks 24 Lessons Practical Projects
Your Progress 0%
LESSON 24 Final Lesson

Final Project: Student Management Program

Combine variables, classes, methods, arrays and decision-making to build a small student management program.

Java Code

Study the example and understand what each part does.

JAVA
import java.util.ArrayList;

class Student {

    String name;
    int age;
    double marks;

    Student(String name, int age, double marks) {

        this.name = name;
        this.age = age;
        this.marks = marks;
    }

    void display() {

        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
        System.out.println("Marks: " + marks);

        if (marks >= 70) {

            System.out.println("Grade: A");

        } else if (marks >= 60) {

            System.out.println("Grade: B");

        } else if (marks >= 50) {

            System.out.println("Grade: C");

        } else {

            System.out.println("Grade: D");
        }
    }
}

public class Main {

    public static void main(String[] args) {

        ArrayList<Student> students =
            new ArrayList<>();

        students.add(
            new Student("Brian", 18, 78)
        );

        students.add(
            new Student("Mary", 19, 85)
        );

        students.add(
            new Student("John", 18, 62)
        );

        for (Student student : students) {

            student.display();

            System.out.println("----------------");
        }
    }
}

Java code normally runs using the Java Development Kit on a computer, Android Studio or another Java development environment. This course page presents the code examples without pretending that the browser is running Java directly.

Expected Output / Result

Name: Brian
Age: 18
Marks: 78.0
Grade: A
----------------
Name: Mary
Age: 19
Marks: 85.0
Grade: A
----------------
Name: John
Age: 18
Marks: 62.0
Grade: B
----------------

Finished this lesson?

Mark it complete to update your course progress.

Quick Knowledge Check

Test your understanding of Java.

What keyword is used to create a class in Java?

Vinsoft Lab Academy

Build real programming skills.

Continue learning Java and explore practical programming, web development and mobile development courses.