Home / MCQ Bank / Computer
Computer Generics In Java

What is the benefit of using generics with collections in Java?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • It ensures type safety by allowing only specific types of elements

Related Computer Questions

Which method is used to create a shallow copy of a dictionary? On UNIX, statements entered in 'MySQL' are saved in which file? What will be the output of the following C# code? public static void Main() { byte varA = 10; byte varB = 20; long result = varA | varB; Console.WriteLine("{0} OR {1} Result :{2}", varA, varB, result); varA = 10; varB = 10; result = varA | varB; Console.WriteLine("{0} OR {1} Result : {2}", varA, varB, result); } What would the time complexity to check if an undirected graph with V vertices and E edges is Bipartite or not given its adjacency matrix? What will be the output of the following Java program? import java.lang.System; class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 0, b, 3, a.length - 3); System.out.print(new String(a) + " " + new String(b)); } }