Which Of The Following Statements Are Valid In The Following C #637
Which of the following statements are valid in the following C# code snippet?</p> <pre><code class="language-csharp" line="1"> public class Generic<T> { public T Field; public void testSub() { T i = Field + 1; } } class Program { static void Main(string[] args) { Generic<int>g = new Generic<int>(); g.testSub(); } } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Delegates, Generics and LINQ - Generic Methods - Quiz No.1.
Which of the following statements are valid in the following C# code snippet?
public class Generic<T> { public T Field; public void testSub() { T i = Field + 1; } } class Program { static void Main(string[] args) { Generic<int>g = new Generic<int>(); g.testSub(); } }
code runs successfully but prints nothing
code runs successfully and prints 1
program will give run time error
compile time error