Multiple choice technology programming languages

To create a public generic method named "update" that has no return type. In its argument list, the method accepts an argument named "updateValue" which is of the same type as the type parameter - T. Which is a valid declaration?

  1. public T update()

  2. public void update(T updateValue)

  3. void update(T updateValue)

  4. public void update()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The correct declaration is 'public void update(T updateValue)'. It has the public modifier, void return type, method name 'update', and accepts a parameter of type T named 'updateValue'. Option A returns T instead of void, C lacks public modifier, D lacks the parameter entirely.