Venciity

[ Telerik C#] Primitives And Variables - EX 7

Feb 13th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. //Declare two string variables and assign them with “Hello” and “World”.
  2. //Declare an object variable and assign it with the concatenation of the first two variables (mind adding an interval).
  3. // Declare a third string variable and initialize it with the
  4. //value of the object variable (you should perform type casting).
  5.  
  6. using System;
  7.  
  8. namespace _07_HelloObject
  9. {
  10.     class HelloObject
  11.     {
  12.         static void Main()
  13.         {
  14.             string word1 = "Hello";
  15.             string word2 = "world";
  16.             object greeting = word1 + " " + word2;
  17.             string castedGreeting = (string)greeting;
  18.             Console.WriteLine(castedGreeting);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment