static void Main string args ConsoleWrite Hello Worldstatic void main string args consolewrite hello worldStatic void main string args consolewrite hello worldStatic Void Main String Args ConsoleWrite Hello WorldSTATIC VOID MAIN STRING ARGS CONSOLEWRITE HELLO WORLD


20. Sending Output

Now that we’ve looked at taking input in our previous chapter, we will look at the opposite process of sending output from a program. The way in which output is given by the program, will differ depending on the type of program we created. So again, let’s look at the different ways output can be processed, depending on the type of program being developed.

20.1 Console Based Applications

We will start again with the simplest form, that being console based applications. Most programming languages have methods that can be used to write data to the console. This process is very important when it comes to testing the behavior of a program and making sure it operates as intended. Let’s look at an example of how this is done in C#.

static void Main(string[] args)

Console.Write(“Hello World”);

The above program is very simple and uses the ‘Console’ class that is available in C#. This class contains a method called ‘Write’, which then writes the string ‘Hello’ to the console. The ‘Console’ class also has the facility to write data to different lines using the ‘WriteLine’ method. Let’s look at a code snippet which will write ‘Hello’ on the first line and ‘World’ now on a second line.