2 methods are defined as below:
public void Add(int a, int b)
{
Console.WriteLine(a + b);
}
public void Add(params int[] val)
{
int sum=0;
for (int i = 0; i < val.Length; i++)
{
sum += val[i];
}
Console.WriteLine(sum);
}
Which method will be called on following statements :
1. Add ();
2. Add ( 4,6);
3. Add (10, 20, 30);
object obj = null;
string strobj = obj.ToString();
string objstr = Convert.ToString(obj);
What will be value of strobj and objstr ?
XYZ class A
{
XXX method1()
......
}
class B : A
{
override method1 ()
{
base.method1();
}
}
what should be replaced with XXX and XYZ?
How does compiler recognizes method having variable number of argumets - for example GetSum ( params int [ ] values) ?
Nullable<int> intvalue = null ;
Console.WriteLine( intvalue ?? 50 ) ;
int x = 10 ;
x = x * 5 + 4 ;
int y = 10 ;
y * = 5 + 4 ;
Values of x and y will be