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);
}
}
- 0 0
- 11.5 0
- Compile-time error
- 11.5 6.5
Correct Answer:
11.5 6.5
need an explanation for this answer? contact us directly to get an explanation for this answer