Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch.claude_martin;
- interface Colorable {
- int RED = 0xff0000, GREEN = 0x00ff00, BLUE = 0x0000ff;
- }
- interface Paintable extends Colorable {
- int MATTE = 0, GLOSSY = 1, RED = 0xDEAD;
- }
- abstract class AColorable implements Colorable, Paintable {
- }
- public class SomeClass extends AColorable implements Colorable, Paintable {
- public static void main(String[] args) {
- new SomeClass().sayHello();
- }
- private void sayHello() {
- System.out.println("hello world");
- System.out.println(this.MATTE); // this is not ambiguous, but the static field should be accessed in a static way
- System.out.println(this.RED); // this is ambiguous, does not compile
- System.out.println(Colorable.RED); // this is not ambiguous
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement