+ 1
why i m unable to print hello()
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;
}
}
+ 7
You declared static method hello() without implementation.
Static and final methods should be implemented where they are declared.