Static methods that use the static modifier are class methods that belong to the entire class, and the code snippets in memory are allocated and loaded with the definition of the class, whereas non-static methods are methods that belong to a specific object, and when the object is created, it has a private code snippet for this method in the object's memory. When you reference a static method, you can prefix it with the object name, or you can use the class name. eg. ClassA instantiates an object objecta,
A static method is defined in ClassA: Run (). can be performed using Classa.run () or Objecta.run ().
A non-static method can access both static data members and non-static data members, while static methods can access static data members only, and non-static methods can access both static and non-static methods, while static methods can only access static data methods. A special note is the main method in the static method, which acts as the entry point for the program, and has only one in each program.
The difference between static and non-static functions