What is the difference between Console.Write() and Console.WriteLine() methods in C#?

35. What is the difference between Console.Write() and Console.WriteLine() methods in C#?

  1. Write() writes a single character while Console.WriteLine() writes a complete line
  2. Write() writes the data on the console without printing a newline while Console.WriteLine() writes the data on the console along with printing a newline
  3. ToFloat(Console.ReadLine());
  4. Write() writes the string on the console while Console.WriteLine() writes the string as well as values of the variables on the console
  5. Both can be used for the same purpose

Answer: B) Write() writes the data on the console without printing a newline while Console.WriteLine() writes the data on the console along with printing a newline

Explanation:

The only difference between the Console.Write() and Console.WriteLine() is that the Console.Write() is used to write data without printing the new line, while Console.WriteLine() is used to write data along with printing the new line.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.