Interfaces questions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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

6th Apr 2017, 11:00 AM
carlos nuñez
carlos nuñez - avatar
2 Answers
+ 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(); }
6th Apr 2017, 11:12 AM
Heng Jun Xi
Heng Jun Xi - avatar
+ 2
override all the methods of the interface.
6th Apr 2017, 11:11 AM
POJO
POJO - avatar