How to make a java class only available to one other class in a package -



How to make a java class only available to one other class in a package -

i have 3 classes, bst, term, , webpages.

bst binary search tree terms in each node.

webpages instantiates bst.

how can ensure bst class only available webpages class? (that requirement of project)

they should in same package, thing makes sense me nested class within webpages. there other way restrict access entire class 1 other class in same bundle can "see" it?

looks inner class best alternative you

here quote javaworld descirbes same situation!

for example, tree class may have method , many helper methods perform search or walk of tree. object-oriented point of view, tree tree, not search algorithm. however, need intimate knowledge of tree's info structures accomplish search. inner class allows remove logic , place own class.

java

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -