“The constructor is not visible” error

前端 未结 3 706
无人及你
无人及你 2020-12-20 19:52

I have two classes :

First, with one constructor :

public class First {

    First (ObjectA myObjectA) {
        //do stuff
    }
}

3条回答
  •  不知归路
    2020-12-20 20:19

    No access modifier for your constructor makes it package private. Assuming that First and Second are in the same package, you can call Second's constructors from first. Another class from another package, however, cannot access any of the constructors.

提交回复
热议问题