Skip to content

Instantly share code, notes, and snippets.

@Guilherme-HRamos
Last active June 30, 2019 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Guilherme-HRamos/3c0ebb917b445bcfc982b185f2dbddd8 to your computer and use it in GitHub Desktop.
Save Guilherme-HRamos/3c0ebb917b445bcfc982b185f2dbddd8 to your computer and use it in GitHub Desktop.
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