Menu
Topics Index
...
`

Intermediate Students - Java Example Program


Intermediate Students
class TestIntermediateStudents
{
    public static void main(String arg[])
    {
        InterStudent is = new InterStudent();
        is.getLanguagesMarks();    
    }
}

class Student
{
    String name;
    int tenth_marks;
}

class InterStudent extends Student
{
    int english;
    int telugu;

    public int getLanguagesMarks()
    {
        return english + telugu;
    }
}

class ScienceStudent extends InterStudent
{
    int physics;
    int chemistry;

    public int getScienceMarks()
    {
        int languages_marks = getLanguagesMarks();
        return physics + chemistry + languages_marks;
    }
}

class BiologyStudent extends ScienceStudent
{
    int botany;
    int zoology;

    public int getTotalMarks()
    {
        int science_marks = getScienceMarks();
        return botany + zoology + science_marks;
    }
}

class MathsStudent extends ScienceStudent
{
    int maths1;
    int maths2;

    public int getTotalMarks()
    {
        int science_marks = getScienceMarks();
        return maths1 + maths2 + science_marks;
    }
}
OUTPUT

DESCRIPTION

© meritcampus 2019

All Rights Reserved.

Open In App