当您具有以下三种类型的类时,如何将这些类分为jar /库?

//#1. A client program which uses Concrete class objects.
public class ClientProgram {
    AbstractBase objA = new ConcreteA();
    AbstractBase objB = new ConcreteA();
    ....
}

//#2. A base abstract class for concrete classes
public abstract class AbstractBase {
     ....
}

//#3. Concrete classes
public class ConcreteA extends AbstractBase {
     ....
}
public class ConcreteB extends AbstractBase {
     ....
}

最佳答案

这是描述创建jar的详细文档:https://docs.oracle.com/javase/tutorial/deployment/jar/build.html

07-25 20:31