Created
September 19, 2021 00:11
-
-
Save evrentan/94087e3e163ba81364a3ccc2fd9c9c9b to your computer and use it in GitHub Desktop.
Java Interface 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
interface Animal {; | |
public void eat(); | |
} | |
// Dog Class implements the Animal interface | |
class Dog implements Animal { | |
//eat moehod body is declared here | |
public void eat() { | |
System.out.println("Dogs eat meat"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment