Static vs Instance | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Static vs Instance

What is best to use in a professional program, accessing methods usins static, like: Example.method(); Or Example ex = new Example(); ex.method(); Or the usage of this ways depends on the circumstances?

20th Nov 2018, 9:58 PM
Jordi sarrato
Jordi sarrato - avatar
1 ответ
+ 5
It depends on the use you are going to give it. For example, if you are programming a game, you can create multiple enemies by instantiating them and editing their values ​​individually. Instead, use static modify all at once.
21st Nov 2018, 3:02 AM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar