Get ready for your Object‑Oriented Programming Test. Use flashcards and multiple-choice questions. Each question includes hints and explanations. Prepare for your exam today!

Multiple Choice

In Box<T>, what is T called?

In a generic declaration, the symbol inside the angle brackets is a placeholder for a type used by the generic. In Box<T>, T is a type parameter. It stands in for any type that will be specified later, letting the same Box code work with different contained types while keeping type safety. When you actually create a specific box, like Box<String>, the String becomes the type argument—the concrete type you supply for T. A concrete class is an actual non-generic class (like String or Box itself in some languages), not the placeholder. A value is an actual object instance, not a type. So T is called a type parameter because it represents a type that will be provided when the generic is instantiated.

In a generic declaration, the symbol inside the angle brackets is a placeholder for a type used by the generic. In Box, T is a type parameter. It stands in for any type that will be specified later, letting the same Box code work with different contained types while keeping type safety. When you actually create a specific box, like Box, the String becomes the type argument—the concrete type you supply for T. A concrete class is an actual non-generic class (like String or Box itself in some languages), not the placeholder. A value is an actual object instance, not a type. So T is called a type parameter because it represents a type that will be provided when the generic is instantiated.