Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27398
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx13.iad.POSTED!not-for-mail |
|---|---|
| From | Wayne <nospam@all.invalid> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Java 8 question about default and static methods in interfaces |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| Lines | 31 |
| Message-ID | <JX4Fu.281210$2R1.21049@fx13.iad> (permalink) |
| X-Complaints-To | abuse@newshosting.com |
| NNTP-Posting-Date | Sun, 26 Jan 2014 09:54:49 UTC |
| Organization | Newshosting.com - Highest quality at a great price! www.newshosting.com |
| Date | Sun, 26 Jan 2014 04:55:13 -0500 |
| X-Received-Bytes | 1445 |
| X-Received-Body-CRC | 3058851530 |
| Xref | csiph.com comp.lang.java.programmer:27398 |
Show key headers only | View raw
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