How to achieve multiple inheritances by using interface in java

357 views

Published on

Program to achieve multiple inheritances by using interface in java.

Published in: Education
  • Be the first to comment

  • Be the first to like this

How to achieve multiple inheritances by using interface in java

  1. 1. //Ques. 15 How to achieve multiple inheritance by using interface in java? interface Father { float HT = 6.2f; void height(); } interface Mother { float HT = 5.8f; void height(); } class child implements Father, Mother { public void height() { float HT = (Father.HT + Mother.HT)/2; System.out.println("n child's height = "+HT); } } class Multi { public static void main(String args[]) { childch = new child(); ch.height();
  2. 2. } } OUTPUT:-

×