why i m unable to print hello() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
7th May 2017, 4:28 PM
shobhit
shobhit - avatar
2 Answers
+ 3
Object u can't call static method.. Remove static: public class Program { public static void main(String[] args) { Neo u = new Neo(); System.out.print(u.hello()); } } interface Dusk { public int hello(); } class World implements Dusk { public int hello() { return 10%5; } } class Neo extends World { public int hello() { return 5; } }
7th May 2017, 4:45 PM
Calviղ
Calviղ - avatar
+ 7
You declared static method hello() without implementation. Static and final methods should be implemented where they are declared.
7th May 2017, 4:39 PM
Alexey
Alexey - avatar