multiple inheritance in java -- With the help of interface

Pubblicato il: 01 ottobre 2020
sul canale di: Daily Tech Talks
35
4

Multiple Inheritance is a feature of object oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with same signature in both the super classes and subclass. On calling the method, the compiler cannot determine which class method to be called and even on calling which class method gets the priority.
we used interface to perform the multiple inheritance in java programming.
example:-
interface fees
{
int fee=70000;
public void show();
}
interface marks
{
int mark=790;
public void show();
}
class student implements fees,marks
{
String name="Ram";
public void show()
{
System.out.println("Name="+name);
System.out.println("Fees="+fee);
System.out.println("Marks="+mark);
}
}
class multiple
{
public static void main(String args[])
{
student s1=new student();
s1.show();
}
}


Tags- java, java programming , inheritance in java, multiple inheritance with the help of interface, what is interface


In questa pagina del sito puoi guardare il video online multiple inheritance in java -- With the help of interface della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Daily Tech Talks 01 ottobre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 35 volte e gli è piaciuto 4 spettatori. Buona visione!