I have created two objects, str and prog. When I print both the objects
Output for Object 1: (The string is printed)
Web World!!
Output for Object 2: (The name of the Class is printed)
Program1
Can someone please explain why is this happening?
using System;
using System.Text;
public class Program1
{
string str1;
public Program1(string str2)
{
str1 = str2;
}
}
public class Program
{
public static void Main()
{
StringBuilder str = new StringBuilder("Web World!!", 30);
Console.WriteLine(str);
Program1 prog = new Program1("Hello");
Console.WriteLine(prog);
}
}