How to make two different packages access each other's classes without allowing any other third package to access it in java? -
i making project in netbeans , facing problem similar 1 asked on site - how share package private data between 2 packages in java? , slight difference of let's application developer can see codebase. thought make public class in package b 'communicator class' contructor having default package access , passing instance in constructor of classes of package a. stopping developer (using package c) instantiating classes inside package a. work not approach se-wise guess. besides question asked 3 years ago. there better approach/technique available neat and/or involves less coupling between packages , b.
ps: new java. appreciated.
you can introduce module has reference of other 2 packages , make module act bridge. 1 thing can done till java 8
Comments
Post a Comment