Generic box

Report a typo

Implement a generic 'Box' class that can store any type of item. Add methods set() and get().

Sample Input 1:

1
Hello

Sample Output 1:

The integer in the box is: 1
The string in the box is: Hello
Write a program in Kotlin
class Box<T>(var value: T) {
//write your code here
}

Create a free account to access the full topic