- 1
Interfaces questions
I have problems implementing the methods of an interface to my main class, how can i fix it? https://code.sololearn.com/ckqrXEFlqWc3/?ref=app
2 Réponses
+ 6
if implement an interface you must override ALL the methods of the interface PROPERLY
If the method in the interface has an int parameter, then you also need to override that method with an int parameter
public class NMG implements Aritmetic
{
//did not have parameter as the interface
@Override
public void Suma(){
int n;
}
//did not override Prod and Per10 which is a must
}
public interface Aritmetic{
public NMG Suma(NMG n);
public NMG Prod(NMG n);
public NMG Per10();
}
+ 2
override all the methods of the interface.