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

📅  最后修改于: 2022-03-11 14:52:44.633000             🧑  作者: 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");
    }
}