What is the equivalent of C++s “friend”?
The keyword “friend” in C++ is a hack to allow a piece of code to access the private member declarations of another class. In the Java programming language, you would do this by labelling, not the friend, but the private members. Instead of making them private, make them either protected or package (no keyword) or public. The four different protection levels are: private, package, protected, and public.