For the code snippet given below, which of the following statements are valid? public class MyContainer<T> where T: class, IComparable { //Insert code here } Class MyContainer requires that it's type argument must implement IComparable interface. Compiler will report an error for this block of code. There are multiple constraints on type argument to MyContainer class. Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.

- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

Question:
For the code snippet given below, which of the following statements are valid?

public class MyContainer<T> where T: class, IComparable
{
    //Insert code here
}
Class MyContainer requires that it's type argument must implement IComparable interface.
Compiler will report an error for this block of code.
There are multiple constraints on type argument to MyContainer class.
Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.

1.1 and 2 Only

2.. 3 and 4 Only

3.2 and 3 Only

4.All of the above


More MCQS Questions and answers

R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!