CJCoding With Joseph
15free / daySign inCreate account

A generic method can declare more than one type parameter. Labels.label declares two, K and V, in the angle brackets in front of its return type, so the key and the value can be of different types. The header is written. Complete the body.

Requirements: 1. label(K key, V value) returns the key, then an equals sign with one space on each side, then the value. The call Labels.label("age", 30) returns age = 30. 2. Return the text. Do not print anything inside the method.

Do NOT write a main method.

Expected output

age = 30
7 = true
x = 2.5

= newline. The output ends with a newline, so print one after the last line.

Hints2 available
Topics
GenericsMethods
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.