“The constructor is not visible” error

前端 未结 3 701
无人及你
无人及你 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:45

    Since you are not mentined any modifier the access modifier is now default, that means it is visible only within its own package

    If you try to use it out side the package, you'll face the current error.

    Try to read :What is the default access modifier in Java?

    If you did'nt get understood what @BackSlash is commenting, check the below link

    Problem with : Calling a method from a superclass

提交回复
热议问题