Java interface - Return on method call -


i've been struggling couple of days trying understand how code below works.

i have: abstract class:

public abstract class screen {      protected final game game;      public screen(game game) {         this.game = game;     }      public abstract void update(float deltatime);     public abstract void paint(float deltatime);     public abstract void pause();     public abstract void resume();     public abstract void dispose();     public abstract void backbutton();  } 

and interface:

public interface game {     public void setscreen(screen screen);     public screen getinitscreen(); } 

i understood interface methods have no body because what classes can do, not how.

then, when call method below class extends screen abstract class:

game.getinitscreen(); 

what method return? new screen? there nothing on screen class...no canvas, no surfaceview...what's point of such call?

because, @ run-time, there class provides concrete implementation of screen. class determined game.getinitscreen().getclass().getname()


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -