Skip to main content
30 events
when toggle format what by license comment
Feb 28, 2017 at 8:38 history protected gnat
Nov 18, 2015 at 7:56 history unprotected yannis
Nov 2, 2015 at 6:13 history protected gnat
May 2, 2014 at 21:00 answer added Loren Pechtel timeline score: 2
Feb 13, 2014 at 21:36 comment added FastAl @hippo and basha - They can use instance methods. Just pass in a reference to an instance as a parameter. They can even access its private members. class Foo { static int FooVal(Foo thisFoo) { return thisFoo.val(); }} Of course in this example you'd just make that an instance method. And most others too. For example if you wanted to use a static method on foo like Foo.compare(foo1,foo2) you could instead make it instance and use it like foo1.compare(foo2). Hope I don't sound like a foo.
Sep 14, 2013 at 19:25 audit First posts
Sep 14, 2013 at 19:26
Sep 12, 2013 at 23:57 comment added hippo-dancer To paraphrase Gertrude Stein: "There's no this there."
Sep 12, 2013 at 20:27 answer added Pedro Henrique A. Oliveira timeline score: 1
Sep 12, 2013 at 4:07 review Close votes
Sep 12, 2013 at 21:01
Sep 12, 2013 at 3:20 comment added Ben Hocking I think it's worth pointing out that static methods sometimes do use non-static data. It's not uncommon for a static method by the name of main to create an instance of the class and to (occasionally) use non-static data from that instance. (Of course, it's not limited to main, but that's where one is most likely to encounter this behavior.)
Sep 12, 2013 at 2:46 comment added acarlon To understand this fully, you also need to consider the inverse - why static methods can't use instance member methods, properties or variables without first creating an instance. Understanding this helps you to see the complete picture.
Sep 11, 2013 at 22:30 answer added sixtyfootersdude timeline score: 1
Sep 11, 2013 at 18:59 comment added user8709 @Geek - the existence of static methods, static data is a language design issue. Assuming standard meanings, the fact that static methods cannot access instance data is not. The limitation is implied by the definitions and what is possible and makes sense, not by some language designers foibles.
S Sep 11, 2013 at 18:32 history suggested Matsemann CC BY-SA 3.0
reworded the question and title
Sep 11, 2013 at 18:25 comment added gnat @Geek apparently, you read the question differently than me
Sep 11, 2013 at 18:19 review Suggested edits
S Sep 11, 2013 at 18:32
Sep 11, 2013 at 18:13 comment added Geek @gnat in this case OP is trying to understand the reason behind a design decision. What do you expect him to try in this case?
Sep 11, 2013 at 18:04 comment added gnat Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask
Sep 11, 2013 at 15:15 history tweeted twitter.com/#!/StackProgrammer/status/377812741484204033
Sep 11, 2013 at 15:01 answer added Tulains Córdova timeline score: 1
Sep 11, 2013 at 14:44 vote accept Srikanth nadimpally
Sep 11, 2013 at 14:10 comment added Doc Brown Google provides you with dozens of explanations, see for example easysteps2buildwebsite.com/2013/05/static-vs-non-static-methods or here cscie160-distance.com/nonstatic.html
Sep 11, 2013 at 14:08 answer added gbjbaanb timeline score: 24
Sep 11, 2013 at 14:04 answer added KChaloux timeline score: 74
Sep 11, 2013 at 14:03 answer added Random42 timeline score: 3
Sep 11, 2013 at 13:57 answer added smp7d timeline score: 3
Sep 11, 2013 at 13:56 comment added user40980 The wikipedia artcile Method may help shead some insight into this.
Sep 11, 2013 at 13:55 comment added mouviciel Because only static data exist from the point of view of static methods.
Sep 11, 2013 at 13:49 history edited 9000 CC BY-SA 3.0
spelling
Sep 11, 2013 at 13:43 history asked Srikanth nadimpally CC BY-SA 3.0