Home / C# Programming / Classes and Objects :: Discussion

Discussion :: Classes and Objects

  1. Which of the following statements is correct about the C#.NET code snippet given below?

     int i;
     int j = new int();
     i = 10;
     j = 20; 
     String str;  
     str = i.ToString();  
     str = j.ToString();
    

  2. A.

    This is a perfectly workable code snippet.

    B.

    Since int is a primitive, we cannot use new with it.

    C.

    Since an int is a primitive, we cannot call the method ToString() using it.

    D.

    i will get created on stack, whereas j will get created on heap.

    E.

    Both i and j will get created on heap.

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment