Nguyễn Hồng Yến
New member
What will be the output of the following C# code?
A. 0 0
B. 10.5 0
C. Compile time error
D. 10.5 5.5
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();
}
}
B. 10.5 0
C. Compile time error
D. 10.5 5.5