0

I have general knowledge of how the static variable works where it's saved in RAM. But what if the static class has a method having more than 1000 + lines, then where is it gone and use it for the lift time of the application. I understand that that could a duplicate question. If anybody answered to this question, please reply below.

public static class staticClass
{
    public static int LongMethod()
    {
        // more than 1000 lines in this method  
    }

}

  • `static` on a method doesn't affect how its code is stored in memory; instead it means that you call it without a particular object. – Nate Eldredge Jul 13 '21 at 04:36
  • @NateEldredge let's say someone added like 10000 lines in the static method inside the static class. How the method is being used in terms of the Memory? – mogotes mogot Jul 13 '21 at 21:13
  • Does this answer your question? [Where are static methods and static variables stored in Java?](https://stackoverflow.com/questions/8387989/where-are-static-methods-and-static-variables-stored-in-java) – Erwin Bolwidt Jul 14 '21 at 01:44
  • @ErwinBolwidt Thank you for the answer. I read it and it's about storing static variables. I know the static variables might be stored in the heap. If the method is super large, then its it still saved in the heap same as variables? – mogotes mogot Jul 14 '21 at 19:35

0 Answers0