Tuesday, May 9, 2017

Student Information Using Inheritance in Java

Here is a very simple program that I wrote using Java as my programming language that demonstrate how to use inheritance. The program will display student information on the screen. I hope you will learn something out of it.  Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

package demo;


class Student {
String name="Mario Chua";
String course="Bachelor of Science in Business Management";
int age=17;
}

public class inheritance extends Student {
String school="Manila State University";
double tuition= 45600.51;

public static void main(String[] args) {
inheritance studs = new inheritance();
System.out.println();
        System.out.println("Student Information Using Inheritance in Java");
        System.out.println();
System.out.println("Student Name : " + studs.name);
System.out.println("Course       : " + studs.course);
System.out.println("Age          : " + studs.age);
System.out.println("School       : " + studs.school);
System.out.println("Tuition Fee  : Php " + studs.tuition);
}

}






No comments:

Post a Comment