This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

an interview question

 
Raja seemakurthi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to return an interface reference type by a any java method?
 
Henry Wong
author
Marshal
Pie
Posts: 21122
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Raja seemakurthi:
is it possible to return an interface reference type by a any java method?


Do you mean something like this?



Henry
 
Raja seemakurthi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, exactly i want that only.

he asked me whether we can return a List type from a method.
later he asked me other quesstion, ie.... if a method can return an interface type then , is it feature of OOPS ar Java?


i said this is OOPs feature only.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if you can do a quick survey and tell how many languages have something comparable to Java's interface. The concept of a pure abstract type like that has been around, but Kent Beck's Implementation Patterns says something like Java is one of the first "mainstream, commercially successful" languages to have "interface" in the language.

I just had to look back at a Turbo Pascal program ... it had "Interface" and "Implementation" keywords to mark off blocks of code even before OO, but I don't recall them being polymorphic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic