What happens during compiling and executing the code:
 
public class GoTest {
    public static void main(String[] args) {
        Sente a = new Sente(); a.go();
        Goban b = new Goban(); b.go();
        Stone c = new Stone(); c.go();
    }
} 

class Sente implements Go {
    public void go() { System.out.println("go in Sente"); }
} 

class Goban extends Sente {
    public void go() { System.out.println("go in Goban"); }
} 

class Stone extends Goban implements Go { }

interface Go { public void go(); }

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes