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
  • 263,463
  • 30
  • 215
  • 251

0 Answers0