Hi I want to implement a method on the lines of friend function in C++. How can I go about it?If it does not, why java doesn't need it?Please suggest how to implement it.. as in a sample:
public class A {//some variables and methods..private and protected to be used by methods in Class B}
public class B {}
Yes, something does exist. Java classes declared in the same package can have access to their package-mates less-than-private members.
This is one of the places where Java and C++ really diverge and you need to get a specific understanding of the Java way to keep from shooting yourself in the foot.