- package com.itheima;
- /**
- *
- * @author 钱伟
- *
- */
- class Icebox
- {
- String door;
- void open()
- {
- System.out.println("打开"+door);
- }
- void close()
- {
- System.out.println("关闭"+door);
- }
- }
- class Elephant
- {
-
- void putElephant()
- {
- System.out.println("把大象放进去");
- }
- }
- class Text
- {
- public static void main(String args[])
- {
- Icebox i = new Icebox();
- i.door = "冰箱门";
- i.open();
- new Elephant().putElephant();
- i.close();
- }
- }
复制代码
|