You are on page 1of 3

Difference Between Write and WriteLine

The Write method is used to print one or more objects on a single line without inserting
a new line character at the end. The WriteLine method inserts a new line character after
printing the output. In the Write method, the cursor remains at the same line, while in
WriteLine it moves to the next.

Write Method
Write method resides inside the ‘Console’ class which itself resides inside the System
namespace. The Console class provides basic support for applications that read and
write characters to and from the console. The write() method outputs one or more
values on the screen without a new line character. This means any subsequent output
will be printed in the same line.
The Write () method outputs one or more values to the screen without a new line
character.
Example of Write() in C#

Output:
Car Bus Truck
WriteLine Method
The WriteLine method also resides inside the ‘Console’ class of the System
namespace. The WriteLine method prints one or more object on a single line with a
new line character inserted at the end. This means any subsequent output will be
printed on a new line.
The WriteLine() always appends a new line character to the end of the string. this
means any subsequent output will start on a new line.
Example of WriteLine() in C#:

Output:
Car
Bus
Truck

You might also like