ExamVeda
Login
Home
Classes and Objects in C Sharp
?

What will be the output of the following C# code?
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(8, 2.5);
          Console.ReadLine();
      }
  }

Answer & Solution
Correct Answer: Option D
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.