I want to program an internal(in C#) class, I was using the keyword ‘Friend’ in vb.Net.
Now I want do the same in Java. What is the equivalent?
Friend Class NewClass
End Class
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no equivalent to
friendin Java. The best you can do is to put the two classes in the same package, and make members of one class package-private (that is, withoutpublic,privateorprotected) to make them accessible to the other.