VB.Net program to demonstrate the difference between Console.Write() and Console.WriteLine() methods

Here, we are going to demonstrate the difference between Console.Write() and Console.WriteLine() methods in VB.Net.
Submitted by Nidhi, on November 26, 2020

We will create a program in VB.Net to demonstrate the difference between Console.Write() and Console.WriteLine() methods.

Program/Source Code:

The source code to demonstrate the difference between Console.Write() and Console.WriteLine() methods is given below. The given program is compiled and executed successfully.

'Program to demonstrate the difference between 
'Console.Write() and Console.WriteLine() method.

Module Module1

    Sub Main()
        Console.WriteLine("This is line1")
        Console.WriteLine("This is line2")
        Console.Write("This is line3")
        Console.Write("This is line4")
        
        Console.ReadLine()
    End Sub

End Module

Output:

This is line1
This is line2
This is line3This is line4

Explanation:

Here, we created a Module that contains the Main() method, and we used Write() and WriteLine() methods of Console class.

Console.WriteLine("This is line1")
Console.WriteLine("This is line2")

Here, we used WriteLine() method message on the console screen, WriteLine() method print newline character to change the line.

Console.Write("This is line3")
Console.Write("This is line4")

Here, we used the Write() method message on the console screen, Write() method does not print newline character.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





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.