RE: [Java] static and non-static 07-18-2013, 04:49 AM
#13
(07-18-2013, 12:48 AM)JDKlett Wrote: Well, you are right. But don't you think that the abuse of these Class information could lead to some complexity later?
In this case you found a good solution for the problem but, for example, a disadvantage that I see is that you were forced to declare also the getNumberOfCar() method as static and that you are loosing a bit the concept of object (because to use this class you are not instantiating any object actually).
As long as you refer to well known approach as the design patterns I think it is all right. Another example could be the pattern singleton.
I think that you agree in the fact that care should be taken in the case you decide to attribute to the class a behaviour.
I agree. *nods*
I also know that beginners tend to overuse static, but that's because they don't understand the concept of object orientiation at all and static helps them to avoid it.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.
Expressed feelings are just an attempt to simulate humans.
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)