I really do not see a difference in these two uses of methods. Could someone be more specific with me and let me know about this?
I really do not see a difference in these two uses of methods. Could someone be more specific with me and let me know about this?
A static method should be created if it makes sense to have it without having an instance of the object.
Simple example: In a Geladeira
class you can have a static double converterCelsiusFahrenheit(double celsiu)
method even if you do not have a refrigerator. Since the void adicionarItem(Item item)
method is referencing a specific refrigerator, so it should not be static, since it needs an instance.