• Post Reply Bookmark Topic Watch Topic
  • New Topic

getBean method call  RSS feed

 
John Paterson
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have code like the following in my project:



I have 2 questions:

1. Why would a class be sent as an argument in a method?
2. Why is the result of the call to the method, where Food class is used as argument, be assigned back to a Food object??

Hope someone can help explain. Thank you.

regards
John
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has to do with how generics works in Java. If you have a function that returns a generic, you need to specify the class of the generic as a parameter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!