Interface example
package com.ram; interface Mother{ int MOTHER_PROPERTY = 1000000; } interface Father{ int FATHER_PROPERTY = 5000000; } class Child implements Mother,Father{ int total_property = MOTHER_PROPERTY + FATHER_PROPERTY; public void display(){ System.out.println("Totoal property of child is = "+total_property); } } public class InterfaceExample { public static void main(String[] args) { Child child = new Child(); child.display(); } }
Execute InterfaceExample class and you get the below output:
Totoal property of child is = 6000000
Totoal property of child is = 6000000
No comments:
Post a Comment