Skip to content
Advertisement

Why do I have an error that my constructor is not visible even though my constructor is public [closed]

I am working on a project to read a text from a note pad and store its content in a dynamic array, then display the list to the user for him to choose a line, then saving the data related to the chosen region in a binary file, then read the binary file and store its content in a data structure of type “Linked List” and save the content of the data structure into a text file.

I created 3 classes two of them are the dynamic array and the linked list. I want to call the dynamic array in a fourth class but it says that the array is not visible even though I declared it as public, and all of my classes are in the same package.

JavaScript
JavaScript

This is a screenshot:
enter image description here

This is the Country class:

JavaScript

this is the linked list class:

JavaScript

Advertisement

Answer

The problem is you have imported an incorrect class. Please look at your import statement in the class Testing.

JavaScript

please remove that import statement.Then you are good to go.

Advertisement