ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

VB.Net program to demonstrate the boxing

Here, we are going to demonstrate the boxing in VB.Net.
Submitted by Nidhi, on December 20, 2020

Here, we will create a variable of integer type and then perform boxing by assigned the value of integer variable to the variable of the Object type.

Program/Source Code:

The source code to demonstrate the boxing is given below. The given program is compiled and executed successfully.

'VB.Net program to demonstrate the boxing.

Module Module1
    Sub Main()

        Dim val As Integer = 10
        Dim obj As Object

        obj = val
        Console.WriteLine("value of obj object : " & obj)
    End Sub
End Module

Output:

value of obj object : 10
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a Main() subroutine.

The Main() subroutine is the entry point for the program. Here we created a variable of integer type and then perform boxing by assigned the value of integer variable to the variable of the Object type, and that on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.