Mercurial > hg > Papers > 2021 > anatofuz-master
view paper/src/java-interface-implements.java @ 56:3a8c21a37bf1
interface
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Feb 2021 14:17:05 +0900 |
parents | |
children |
line wrap: on
line source
// interface interface Animal { public void animalSound(); // interface method (does not have a body) public void sleep(); // interface method (does not have a body) } // Pig "implements" the Animal interface class Pig implements Animal { public void animalSound() { // The body of animalSound() is provided here System.out.println("The pig says: wee wee"); } public void sleep() { // The body of sleep() is provided here System.out.println("Zzz"); } }