Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 7
    Java omits multiple class inheritance, but allows multiple interface inheritance. This is how Java has always worked. Commented Nov 23, 2014 at 3:09
  • 1
    @raptortech97 this isn't true. Every such definition in an interface is just implicitly public static final. The value of item cannot be changed and it can be accessed like this: SuperType2.item. I wouldn't overuse it though and the naming conventions are off. Without the ambiguity, s.item would also work but this is not the right way to access this constant and most code analysis tools will consider it a violation. The code does not compile because of the assignment of a double 2.0 to a float (loss of precision) and the ambiguous use of s.item. Commented Nov 23, 2014 at 8:14
  • 2
    @raptortech97 Actually the above code will compile using a Java 8 compiler. Commented Nov 23, 2014 at 13:28