- class MainBoard
- {
- public void run()
- {
- System.out.println("mainboard run");
- }
- /*
- public void useNetCard(NetCard c)//useNetCard方法和NetCard类是怎么产生关系的?
- {
- c.open();
- c.close();
- }
- }*/
- public void useNetCard()
- {
- NetCard n=new NetCard();
- n.open();
- n.close();
-
- }
- class NetCard
- {
- public void open()
- {
- System.out.println("netcard open");
- }
- public void close()
- {
- System.out.println("netcard close");
- }
- }
- class DuoTaiDemo
- {
- public static void main(String[] args)
- {
- MainBoard mb=new MainBoard();
- mb.run();
- //NetCard a=new NetCard();
- //mb.useNetCard(new NetCard());
- mb.useNetCard();
- }
- }
复制代码 为什么出现E:\my_java\day08>javac DuoTaiDemo.java
DuoTaiDemo.java:42: 错误: 进行语法分析时已到达文件结尾
}
^
1 个错误 |
|