Разница между статическими методами и методами экземпляров

Я просто перечитывал текст, данный мне в моем учебнике, и я не совсем уверен, что понимаю, о чем он говорит. Это в основном говорит мне, что статические методы или методы класса включают в себя «модификатор» ключевое слово статическое. Но я действительно не знаю, что это значит?

Может ли кто-нибудь объяснить мне в очень простых терминах, что такое статические или классовые методы?

Кроме того, могу ли я получить простое объяснение, что такое методы экземпляра?

Вот что они дают мне в учебнике:

There are important practical implications of the presence or absence of the static modifier. A public class method may be invoked and executed as soon as Java processes the definition of the class to which it belongs. That is not the case for an instance method. Before a public instance method may be invoked and executed, an instance must be created of the class to which it belongs. To use a public class method, you just need the class. On the other hand, before you can use a public instance method you must have an instance of the class.

The manner in which a static method is invoked within the definition of another method varies according to whether or not the two methods belong to the same class. In the example above, factorial and main are both methods of the MainClass class. As a result, the invocation of factorial in the definition of main simply references the method name, "factorial".

Ответы на вопрос(10)

Ваш ответ на вопрос