執行 ❯
獲取您
自己的Java
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
interface Animal { public void animalSound(); // interface method (does not have a body) public void sleep(); // interface method (does not have a body) } class Pig implements Animal { public void animalSound() { System.out.println("The pig says: wee wee"); } public void sleep() { System.out.println("Zzz"); } } class Main { public static void main(String[] args) { Pig myPig = new Pig(); myPig.animalSound(); myPig.sleep(); } }
豬說:哼哼
呼呼