Exp 8
*********Exp 8: Concept of hybrid inheritance*******
package te04;
public class multiinhe {
public static void main(String[] args) {
result obj=new result ();
obj.display();
// TODO Auto-generated method stub
}
}
class student
{
int roll=50;
}
interface marks
{
int m1=80,m2=70;
}
interface sports
{
int game1=35,game2=40;
}
class result extends student implements marks,sports
{
void display()
{
System.out.println("Roll No="+roll);
System.out.println("Marks obtained in m1="+m1);
System.out.println("Marks obtained in game1="+game1);
}
}
******OUTPUT*****
Roll No=50
Marks obtained in m1=80
Marks obtained in game1=35
package te04;
public class multiinhe {
public static void main(String[] args) {
result obj=new result ();
obj.display();
// TODO Auto-generated method stub
}
}
class student
{
int roll=50;
}
interface marks
{
int m1=80,m2=70;
}
interface sports
{
int game1=35,game2=40;
}
class result extends student implements marks,sports
{
void display()
{
System.out.println("Roll No="+roll);
System.out.println("Marks obtained in m1="+m1);
System.out.println("Marks obtained in game1="+game1);
}
}
******OUTPUT*****
Roll No=50
Marks obtained in m1=80
Marks obtained in game1=35
Comments
Post a Comment