📄 testinterface.java
字号:
import java.util.Random;
public class TestInterface
{
public static void main(String[] args)
{
PetOutput[] thePets = {
new Dog("Rover", "Poodle"),
new Cat("Max", "Abyssinian"),
new Duck("Daffy","Aylesbury"),
new Spaniel("Fido")
};
PetOutput petChoice;
Random select = new Random(); // Random number generator
for(int i = 0; i < 5; i++)
{
petChoice = thePets[select.nextInt(thePets.length)];
System.out.println("\nYour choice:\n" + petChoice);
petChoice.sound();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -