About 43,300 results
Open links in new tab
  1. What does the 'static' keyword do in a class? - Stack Overflow

    A static method cannot refer to non-static data members or variables and cannot call non-static methods too. The following program shows the implementation of the static method in Java:

  2. Are static methods inherited in Java? - Stack Overflow

    Apr 24, 2012 · You can use the inherited members as is, replace them, hide them, or supplement them with new members The only difference with inherited static (class) methods and inherited …

  3. Java - about using classes with static members vs. not

    Jun 18, 2011 · So I have a question regarding best practices. Basically I'm doing the following to make accessing members of different classes easier: class myClass1 { public static int var1; …

  4. java - What does the "static" modifier after "import" mean? - Stack ...

    Oct 2, 2008 · The static modifier after import is for retrieving/using static fields of a class. One area in which I use import static is for retrieving constants from a class.

  5. java - What is the difference between a static method and a non …

    A static method belongs to the class itself and a non-static (aka instance) method belongs to each object that is generated from that class. If your method does something that doesn't depend …

  6. What is a "static class" in Java? - Stack Overflow

    Well, Java has "static nested classes", but they're not at all the same as C#'s static classes, if that's where you were coming from. A static nested class is just one which doesn't implicitly …

  7. Java and inherited static members - Stack Overflow

    1 Unlike what other answers said, there IS a solution to your problem, though it doesn't involve "static inheritance". You should have a per-class ID generator. Here is a good example: Java: …

  8. Static method cannot access instance members of a class

    Feb 7, 2017 · In Liang's 9th edition Introduction to Java Programming it states, "A static method cannot access instance members of a class," (pg 312). I see why an instance member of a …

  9. java - Why can't inner classes declare static members? - Stack …

    The Java Tutorial says that since an inner class is associated with an instance of the enclosing class, it (the inner class) cannot define any static members itself. It's interesting for me why ca...

  10. Where are static methods and static variables stored in Java?

    181 Static methods (in fact all methods) as well as static variables are stored in the PermGen section of the heap, since they are part of the reflection data (class related data, not instance …