2014-01-18 87 views
-1

我的井字游戏程序有一个小问题,这是创建单元格的代码。我正在使用ACM库,因此不需要System.out打印:找不到符号

import acm.program.*; 

public class Cell { 
    Cell_content content; 
    int row; 
    int col; 

    // Constructor to make an empty cell 
    public Cell(int row, int col) { 
     this.row = row; 
     this.col = col; 
     content = Cell_content.EMPTY; 
    } 

    //Content to print inside the cell 
    public void cellPrint() { 
     switch (content) { 
      case CROSS: print(" X "); break; 
      case NOUGHT: print(" O "); break; 
      case EMPTY: print(" "); break; 
     } 
    } 
} 
+5

显示完整的错误消息,并指明行导致的。 –

+0

为什么你不能只使用'System.out.println'? –

+0

1)所有的印刷 2)我们的老师问我们如此 – pgetsos

回答

2

的方法print()abstract class Program定义,只是导入,这并不做任何事情。

您必须扩展抽象类以使print()方法可供您使用。

public class Cell extends Program { } 
+0

这是问题...非常感谢!不知道:/ – pgetsos

2

你需要从ACM的Program类之一延伸到利用的print方法

public class Cell extends ConsoleProgram { 
+0

这是问题...非常感谢!不知道:/ – pgetsos