Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Medium - Android/Java Interfaces like a Boss! - Simple interface use example
class MainClass {
public static void main(final String... args) {
// Se uma classe implementa uma interface,
// então a classe É a interface
MyInterface myInterface = new MyConcreteClass();
myInterface.doSomething();
}
}
// Interface utilizada
interface MyInterface {
void doSomething();
}
// Classe que implementa a interface utilizada
class MyConcreteClass implements MyInterface {
@Override
public void doSomething() {
// some code here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment