Write a program to demonstrate the use of concept of Boxing and Unboxing

Write a program to demonstrate the use of concept of Boxing and Unboxing

CODING:-

using System;
class edit
{
public static void Main()

{

int m=100;
object om=m;
m=20;
Console.WriteLine("The value of m is : "+m);
Console.WriteLine("The value of om is : "+om);
int n=(int)om;
Console.WriteLine("The value of n is : "+n);//n=100
}

}

No comments:

Post a Comment