⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 horrific.java

📁 非常好的java事例以及带源码事例的java2教程
💻 JAVA
字号:
// Try out observers
import java.util.*;

public class Horrific
{
  public static void main(String[] args)
  {
    JekyllAndHyde man = new JekyllAndHyde();  // Create Dr. Jekyll
    
    Observer[] crowd = {
                        new Person("Officer","What's all this then?"),
                        new Person("Eileen Backwards", 
                                  "Oh, no, it's horrible - those teeth!"),
                        new Person("Phil McCavity",
                              "I'm your local dentist - here's my card."),
                        new Person("Slim Sagebrush",
                                    "What in tarnation's goin' on here?"),
                        new Person("Freaky Weirdo",
                          "Real cool, man. Where can I get that stuff?")};

    // Add the observers
    for(int i = 0; i < crowd.length; i++)
      man.addObserver(crowd[i]);

    man.drinkPotion();                 // Dr. Jekyll drinks up
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -