📜  在类中找不到 main(String[]) 方法 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:07.881000             🧑  作者: Mango

代码示例2
class TapeDeckcTestDrive{
    public static void main(String[] args){
        TapeDeck t = new TapeDeck();
        t.canRecord = true;
        t.playTape();

        if (t.canRecord == true) {
            t.recordTape();
        }
    }
}

class TapeDeck {
    boolean canRecord = false;
    void playTape(){
        System.out.println("tape playing");
    }
    void recordTape(){
        System.out.println("tape recording");
    }
}