Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27398
| From | Wayne <nospam@all.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Java 8 question about default and static methods in interfaces |
| Message-ID | <JX4Fu.281210$2R1.21049@fx13.iad> (permalink) |
| Organization | Newshosting.com - Highest quality at a great price! www.newshosting.com |
| Date | 2014-01-26 04:55 -0500 |
Consider the following Java 8 interfaces:
public interface Foo {
default void method () {
System.out.println("Foo.method");
}
}
public interface Bar extends Foo {
default void method () {
System.out.println("Bar.method");
}
}
The question is, can Foo.method be used from Bar.method?
In other words, is the following version of Bar legal?
public interface Bar extends Foo {
default void method () {
super.method();
System.out.println("Bar.method");
}
}
I didn't see a reference in the docs I used, if static
methods can be redefined as well. Does anyone know?
I'd appreciate a link I could use for a better reference
than the Oracle Java Tutorial.
--
Wayne
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Java 8 question about default and static methods in interfaces Wayne <nospam@all.invalid> - 2014-01-26 04:55 -0500
Re: Java 8 question about default and static methods in interfaces Arne Vajhøj <arne@vajhoej.dk> - 2014-01-26 07:56 -0500
Re: Java 8 question about default and static methods in interfaces Arne Vajhøj <arne@vajhoej.dk> - 2014-01-26 13:12 -0500
Re: Java 8 question about default and static methods in interfaces Wayne <nospam@all.invalid> - 2014-01-26 20:37 -0500
csiph-web