問題文
What is the difference between declaring the type parameter on a class and declaring it on a method?
選択肢
- A method level parameter has to be written explicitly at the call site, while a class level parameter can be inferred from the arguments of the constructor by the compiler.
- A class level parameter is available to static members as well, because it belongs to the class rather than to any particular instance that was created from it.
- A class level parameter is fixed when the instance is created and shared by all of its members, while a method level parameter is chosen anew at each call.
- A method level parameter can only be used in the return type of that method, and the arguments have to be declared with concrete types, so the compiler binds the parameter from the return context alone.