When using generics, what happens if I omit the type argument in either the declaration or the
Question:
When using generics, what happens if I omit the type argument in either the declaration or the constructor call?
\begin{tabular}{llll}
Stack stack & \(=\) new Stack ()\(;\) & & // unsafe \\
Stack & stack & \(=\) new Stack(); & \(/ /\) unsafe \\
Stack stack & \(=\) new Stack(); & \(/ /\) correct
\end{tabular}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne
Question Posted: