Forum Stats

  • 3,852,824 Users
  • 2,264,140 Discussions


Problem with protected constructor

Tuan Ha
Tuan Ha Member Posts: 1
edited Aug 22, 2017 9:08AM in Java Desktop Applications

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



This discussion has been closed.