Q:

What will be the output of the following code snippet?

0

What will be the output of the following code snippet?

using System;
class sample
  {
      int i;
      double k;
      public sample (int ii, double kk)
      {
          i = ii;
          k = kk;
          double j = (i) + (k);
          Console.WriteLine(j);
      }
      ~sample()
      {
          double j = i - k;
          Console.WriteLine(j);
      }
  }
  class Program
  {
      static void Main(string[] args)
      {
          sample s = new sample(9, 2.5);
      }
  }

  1. 0 0
  2. 11.5 0
  3. Compile-time error
  4. 11.5 6.5

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Correct Answer:

11.5 6.5

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now