Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interface implementation problem

 
Kumar Sushil
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this Q. in mock Exam

interface TestA {
String toString();
}

public class Test implements TestA{
public static void main(String[] args){
System.out.println("hello");
}
}

If, we implement an interface, this is necessary that we implement methods of that interface. But here this not happening. Is this due to toString() method of Object class?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by johny martin:
...Is this due to toString() method of Object class?

Yes, the implementation is inherited from Object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic