This class sure is getting used a lot. Here, I've declared a static variable as a counter. Since this belongs to the class and not any particular instance, incrementing it in the constructor increments the count on each new object I create.
|CLICK ME SO YOU CAN READ ME!|
Probably could have shown the effect with fewer items, but still. You can see that for each new object we create, the counter increases by 1 on each item. Fun times. Good for keeping track. If count wasn't static, on each object initialization, it would be 0, and you'd get a whole bunch of 1's, which is fairly useless. The general point is, static variables are accessible by any instance of an object, and it changes it for all other instances as well.
You can have static methods, too, and we see that "main" is one, they more or less aren't used except for main, though, as far as I can tell, but its there if you need it for some reason.
Tomorrow, I'll do a double update to make up for that missed update a couple nights ago, but for now,
that's it for tonight.Questions welcome! Comment, follow, subscribe, share etc, and see you tomorrow!
And as part of a shameless plug for a friend, if you're interested in classic movies/books/music, visit his site here (fixed), and feel free to throw loads of criticism at us.