• Post Reply Bookmark Topic Watch Topic
  • New Topic

Will it compile.?  RSS feed

 
Akash Trivedi
Greenhorn
Posts: 18
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Shouldn't a method after line 7 needs to implement the doIt() method which Phone3 inherits from Electronics ?
 
Knute Snortum
Sheriff
Posts: 4270
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Class Phone2 does implement the method doIt(), don't you think?

Note on your post: you should use code tags to surround your code to make it look better. I did it for you this time. Follow the link to learn more.
 
Tim Moores
Saloon Keeper
Posts: 4019
94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean. All 4 classes have the method that implements the interface.
 
Stephan van Hulst
Saloon Keeper
Posts: 7961
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a compiler, there's a very easy way to find out.
 
Fred Kleinschmidt
Bartender
Posts: 571
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything is ok as written. But things change if Electronic is made abstract and its doit() method is declared abstract.
 
Akash Trivedi
Greenhorn
Posts: 18
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer. I think, the Electronic class implemented the doIt() method which Phone3 class inherited.So it does implement. :E
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!