class Student { private int roll_no; private String name; void get_student(int roll_no,String name) { this.roll_no = roll_no; this.name = name; } void display_student() { System.out.print("\nRoll_no: "+roll_no); System.out.print("\nName: "+name); } } interface Test { final static int m1 = 100; final static int m2 = 100; void display_test(); } class Result extends Student implements Test { private float per; public void display_test() { System.out.print("\nMarks1: "+m1); System.out.print("\nMarks2: "+m2); } void display_result() { per = (((m1+m2)/200)*100); System.out.println("\nPercentage: "+per); } } class Multiple_inheritance { public static void main(String s[]) { Result r = new Result(); r.get_student(10,"ABC"); r.display_student(); r.display_test(); r.display_result(); } }
Output![]()
great
ReplyDeleteThanks for IT the
Delete