Skip to content

Instantly share code, notes, and snippets.

@moralez
Created March 17, 2016 15:06
Show Gist options
  • Save moralez/b92a9c4511267c1a9da7 to your computer and use it in GitHub Desktop.
Save moralez/b92a9c4511267c1a9da7 to your computer and use it in GitHub Desktop.
import android.util.Log;
/**
* Created by jmoralez on 3/17/16.
*/
public class NestedInterfaces {
public NestedInterfaces() {}
public void test() {
One one = new One() {
@Override
public void hi(Two two) {
Log.i("JMO", "hi");
two.hello(new Three() {
@Override
public void howdy() {
Log.i("JMO", "howdy");
}
});
}
};
one.hi(new Two() {
@Override
public void hello(Three three) {
Log.i("JMO", "hello");
three.howdy();
}
});
}
public interface One {
void hi(Two two);
}
public interface Two {
void hello(Three three);
}
public interface Three {
void howdy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment