☰
d2jsp
Rules
Help
Forum Gold FAQ
Live Streams
Photo Gallery
Hourly Raffle
Ladder Slasher
Log In
Register
Log In
Register
Account Recovery
Resend Validation Email
d2jsp Forums
>
Off-Topic
>
Computers & IT
>
Programming & Development
> An Object Using Static? :o
Add Reply
New Topic
New Poll
Views: 454
Replies: 2
Track Topic
ferf
Member
Posts: 31,292
Joined: Mar 25 2009
Gold
:
0.00
#1
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)
carteblanche
Member
Posts: 32,925
Joined: Jul 23 2006
Gold
:
3,804.50
#2
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
pzold
Member
Posts: 8,992
Joined: Mar 24 2013
Gold
:
18,115.00
#3
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
© 2003-2024 d2jsp
Contact