//1)编写打印类Printer,声明私有属性index,初始值为1,用来表示是第几次打印。 //2)在打印类Printer中编写打印数字的方法print(int i),3的倍数就使用wait()方法等待,否则就输出i,使用notifyAll()进行唤醒其它线程。 //3)在打印类Printer中编写打印字母的方法print(char c),不是3的倍数就等待,否则就打印输出字母c,使用notifyAll()进行唤醒其它线程。 //4)编写打印数字的线程NumberPrinter继承Thread类,声明私有属性private Printer p; // 在构造方法中进行赋值,实现父类的run方法,调用Printer类中的输出数字的方法。 //5)编写打印字母的线程LetterPrinter继承Thread类,声明私有属性private Printer p; // 在构造方法中进行赋值,实现父类的run方法,调用Printer类中的输出字母的方法。 //6)编写测试类Test,创建打印类对象,创建两个线程类对象,启动线程。 public class HomeWork2 { public static void main(String[] args) { Printer printer = new Printer(); NumberPrinter numberPrinter = new NumberPrinter(printer); LetterPrinter letterPrinter = new LetterPrinter(printer); numberPrinter.start(); letterPrinter.start(); } } //打印类 class Printer{ private static int index=1;