0

If we declare a string variable inside a method, will its memory be allocated in the Stack or in the Heap?

class Test
{
    public void display()
    {
        string str = "sujeet";
        Console.WriteLine(str);
    }

    static void Main(string[] args)
    {
        Test _test = new Test();
        _test.display();
    }
}
trincot
  • 317,000
  • 35
  • 244
  • 286

0 Answers0