Chciałbym zrozumieć, dlaczego można najpierw wywołać metodę kwadrat, a dopiero poniżej ją zdefiniować?
wywołanie metody kwadrat
Musisz się zalogować, aby dodać komentarz
15 czerwca 2021, 14:08
I don't understand your question without having example code of what you are talking about, but I will try to answer Java pre-loads class data, such as fields and methods, at run time. So, unlike a language like C or Python, it matters not where the code is defined, just as long as it does exist. You can shuffle the order of all the fields, methods, constructors of a class and it will still function exactly the same.
15 czerwca 2021, 14:15
Take these two classes as an example. While they are structured different they are functionally identical. This is because they both have the same methods/fields/constructors (I didn't code in a constructor here but that would mean they both have a default constructor):