1first write main class firfirst write main class first that have public static void main with its all content then other classesst that have public static void main with its all content then other classes
1class TapeDeckcTestDrive{
2 public static void main(String[] args){
3 TapeDeck t = new TapeDeck();
4 t.canRecord = true;
5 t.playTape();
6
7 if (t.canRecord == true) {
8 t.recordTape();
9 }
10 }
11}
12
13class TapeDeck {
14 boolean canRecord = false;
15 void playTape(){
16 System.out.println("tape playing");
17 }
18 void recordTape(){
19 System.out.println("tape recording");
20 }
21}