In Java, one interface can extend multiple interfaces.
Syntax
interface MyInterface extends interface1, interface2...interfaceN{
......
......
}
Example
public interface AppUtil extends WelcomeUtil, LogUtil{
.....
.....
}
Find the below working application.
WelcomeUtil.java
package com.sample.app.interfaces;
public interface WelcomeUtil {
public void sayHi();
}
LogUtil.java
package com.sample.app.interfaces;
public interface LogUtil {
public void log(String msg);
}
AppUtil.java
package com.sample.app.interfaces;
public interface AppUtil extends WelcomeUtil, LogUtil{
public String appDetails();
}
You may like
How to get the capacity of ArrayList in Java?
volatile reference vs Atomic references defined in java.util.concurrent.atomic package
Check whether I have JDK or JRE in my system
How to check whether string contain only whitespaces or not?
How to call base class method from subclass overriding method?
No comments:
Post a Comment