Question: MC question about programming (java language) Consider the following class: class Greeter { String name; public void sayHello() { System.out.println(Hello + name); } Select the




Consider the following class: class Greeter \{ String name; public void sayHello() \{ System.out.println("Hello" + name); \} Select the correct statement about generics in the following method declaration public static void foo( T a a. sayHello(); \} Select one: a. T can be instantiated with any class b. Tcan be instantiated with any subclass of Greeter c. the body of the method is incorrect, as T may not have a method Consider the following code public static void add(int a, int b) \{ return a+b; \} public static void add(String a, String b) \{ return a+b; \} This is an example of... Select one: a. Ad-hoc polymorphism b. Parametric polymorphism Marked out of 1.00 P Flag question Consider the following generic data type: class TreeNode
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
