Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class student
- {
- int roll;
- void accept()
- {
- Scanner t = new Scanner (System.in);
- System.out.println("enter roll no.");
- roll = t.nextInt();
- }
- void display()
- {
- System.out.println("Roll no "+roll);
- }
- }
- class test extends student
- {
- int m1,m2;
- void accept()
- {
- super.accept();
- Scanner t = new Scanner(System.in);
- System.out.println("enter m1 and m2");
- m1 = t.nextInt();
- m2 = t.nextInt();
- }
- void display()
- {
- super.display();
- System.out.println("m1 = "+m1+"m2 = "+m2);
- }
- }
- interface sport
- {
- final static int score = 99;
- }
- class result extends test implements sport
- {
- int total=0;
- void accept()
- {
- super.accept();
- total = m1+m2+score;
- }
- void display()
- {
- super.display();
- System.out.println("Score = "+score);
- System.out.println("Total = "+total);
- }
- }
- class java18
- {
- public static void main(String args[])
- {
- result r = new result();
- r.accept();
- r.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement