Last active
June 30, 2019 19:31
-
-
Save Guilherme-HRamos/3c0ebb917b445bcfc982b185f2dbddd8 to your computer and use it in GitHub Desktop.
Medium - Android/Java Interfaces like a Boss! - Simple interface use example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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