0 Replies Latest reply on Aug 22, 2017 1:02 PM by Tuan Ha

    Problem with protected constructor

    Tuan Ha

      I have 2 class in 2 package: class ClassOne in package1 and clas ClassTwo in package2. Class ClassTwo extends class ClassOne which have a protected constructor: protected ClassOne(String s). When i call protected constructor of ClassOne in constructor of ClassTwo it get none error but i can see it when do ctrl+space, it just show a public constructor super(). So what is this problem, why IDEs not show protected constructor when i ctrl+space?



      package package1;


      public class ClassOne {

          public ClassOne(){



          protected ClassOne(String s){





      package package2;


      import package1.ClassOne;


      public class ClassTwo extends ClassOne{

          public ClassTwo(){

              super("Why this protected constructor can use but not visiable?");//i can use this constructor protected ClassOne(String s) but can see it when ctrl+space