Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

blocking access between files

+6 votes
asked Oct 9, 2024 by Muhammed Alim Karacay (180 points)
Why can't I restrict access to my classes in other files from the main file? I've tried everything, and access continues as long as I don't make them private. However, I want to keep access between classes defined in the same file. When I make them private, that access is also lost. The language is Java btw. Thank you.

1 Answer

0 votes
answered Oct 9, 2024 by Peter Minarik (101,420 points)

I believe you need to specify the access as protected and use packages.

https://www.geeksforgeeks.org/access-modifiers-java/

Good luck!

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...