trying to understand access tomembers within a package
<p>Good morning</p>

<p>I am learning Java and trying to understand the access to class members inside a package.
I have to files in MemberAccess directory and called the package unitOne.MemberAccess(is that right?)</p>

<p>Here is the simple example.</p>

<pre><code>package unitOne.MemberAccess;

public class Parent 
{
    private String secret = "This is my secret"; 
    protected String inherit = "All my money";

    int age = 100; 

    public void singInShower()
    {
        System.out.println("la-di-da");
    }
}   
</code></pre>

<p>new I created a seperate file in the same package called OtherPerson.</p>

<pre><code>package unitOne.MemberAccess;

class OtherPerson
{


    public static void main(String[]args)
    {
        OtherPerson op = new OtherPerson();
        System.out.println(op.inherit);
        System.out.println(op.age);
    }   

}
</code></pre>

<p>The problem is that I get a compile time error explaining to me that the symbol cannot be found.
But in my understanding protected and default members in the same package as another class can be viewed by that class.</p>

<p>Regards
Arian</p>
