d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > An Object Using Static? :o
Add Reply New Topic New Poll
Member
Posts: 31,292
Joined: Mar 25 2009
Gold: 0.00
Jul 14 2019 10:55pm
private static StockList stockList = new StockList();



^wondering what the static part does for this.... as it's an object instance of StockList class

I know what static methods and variables do, but i've never heard of a static instance of class (an object, that is)
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 14 2019 11:12pm
Quote (ferf @ Jul 15 2019 12:55am)

I know what static methods and variables do, but i've never heard of a static instance of class (an object, that is)


it's just a static variable. nothing different
Member
Posts: 8,992
Joined: Mar 24 2013
Gold: 18,115.00
Jul 15 2019 10:32am
Just a static object which must be handled in a static context.
For an interesting example of using static instance of a class, google singleton design pattern.

This post was edited by pzold on Jul 15 2019 10:33am
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll