java - How to solve name conflict of method in two interfaces -



java - How to solve name conflict of method in two interfaces -

i have 2 interfaces, have same method different homecoming value such float , double. how can implement both of them in class, not alter method name?

//calculate.java public interface calculate { final float pi = 3.141592f; float getcircumference(float r); float getarea(float r); } interface geometryshape{ public static final float pi = 3.14159f; public abstract float getcircumference(float r); public abstract double getarea(float r); public abstract void draw(); } //circ.java public class circ implements calculate, geometryshape{ public float getcircumference(float r){ homecoming calculate.pi * 2 * r; } public float getarea(float r){ homecoming calculate.pi * r * r; }

you can't implement both interfaces unless methods differ in parameter types (or method name) when homecoming different types.

from jls-8.1.5,

a class cannot have multiple methods same signature , different primitive homecoming types (§8.4).

java

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -