Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Interface;
- class Student {
- int id;
- public Student(int id) {
- this.id = id;
- System.out.println("ID of the student is: "+this.id);
- }
- }
- class Marks extends Student {
- int marks;
- public Marks(int marks){
- super(2);
- this.marks = marks;
- System.out.println("Marks of the student are: "+this.marks);
- }
- }
- class Subject extends Marks {
- String subject;
- public Subject(String subject){
- super(89);
- this.subject = subject;
- System.out.println("Subject of the student is: "+this.subject);
- }
- }
- public class PrintDetails {
- public static void main(String[] args) {
- Subject sj = new Subject("English");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement