给出信号量定义class MeinThread extends Thread {
    private Semaphore sem; /* Semaphor-Objekt */
    private String name;
    MyThread(String name, Semaphore sem) {
        this.name = name;
        this.sem = sem;
    }
    public void run() {
        try {
            sem.acquire();
            System.out.println(name+" -> 进入临界区");
            sleep(1800); /*临界区*/
            System.out.println(name+" <- 退出临界区");
            sem.release();
        } catch (Exception e) { }
    }
}class Example {
    public static void main(String[] args) {        Semaphore s = new Semaphore(1);        MyThread t1 = new MyThread("Thread_1",s);
        MyThread t2 = new MyThread("Thread_2",s);
        t1.start();
        t2.start();
    }
}定义一个抽象类KFZ(汽车生产任务,也是由Thread派生出),由此定义不同的汽车型号的子类KFZ-Modells,此外由Semaphore类派生出对应汽车型号的生产机器类Maschinen,KFZ-Modells的属性列表里给出所需要的生产机器的描述,一种机器对应一个汽车型号的生产(sleep(. . . ) insert)现在需要写一个程序,有五个汽车生产任务,至少要有三种生产型号,至少在四个生产机器上生产,注意在控制台输入数据的清楚的描述;;小弟刚接触java,对这种题目实在是一筹莫展,哪位大大能教教我?能否写出代码,谢谢了!!!