Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

interfaces  RSS feed

 
daya daya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
i am beginner in java.
i have some doubts regarding interfaces.guide me please.
can we create objects for interfaces?how?
can we specify an interface as a return type in method?how?
dayadaya.
 
daya daya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
list is an interface.
i saw a method like public list something()
how is it possible?
i am very much confused
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we create objects for interfaces?


No, you can't instantiate (creating objects) an interface.

can we specify an interface as a return type in method?how?


Yes, like this way:

 
daya daya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks rathi
i got it
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!