The question I'm asking is about a very frequent topic but I didn't find my exact question so I'm asking it explicitly.
I'm programming in java and I need to implement some classes, let's say A, B, C and D. They are all part of an SDK and only D will be public (visible to the developer that will use my sdk).
A, B & C are classes dealing with different topics (let's say Bluetooth communciation, web services use & proprietary algorithms) although they need to communicate each other. I'd like to divide classes in packages according to their "skill" (Public methods, Bluetooth, Web Services, Algorithms) but if I create different packages they won't be visible each other.
So, the only implementation I see here is a unique package and no modifier (so they will "see" each other and the user will only access to Class D). Is there any way to create different packages in order to let me organize my sdk in a better way? (imagine a lot of classes, it could easily become a mess :) )
Thanks in advance for your help
Giorgio
If I understand what you're trying to do, I don't think the Java language gives you a way to do it.
My understanding of your question is "I am developing an API in which I want to expose only certain classes and/or methods; other classes and/or methods in the package need to be used by the exposed ones, but I do not want them to be marked public and therefore available to a programmer using the API".
You don't say why this is necessary, or desirable.
The language does not support visibility this way. You could possibly run the code you want to hide through an obfuscator, to (greatly) discourage anyone from understanding what those methods are and calling them, and of course not obfuscate the ones you want used, but that's as close as I can come up with.