Java Access Modifiers - Public function/variable in protected class
<p>Good day,</p>

<p>if I have a class somewhat like this:</p>

<pre><code>public class A {
        protected class B {
                public int element;
                public int get() {
                        return i;
        }
}
public class C {
        foo();
}
public class D extends A {
        foo();
}
</code></pre>

<p>1.Could foo() in class C, access element and get()? Or can only class D access them?</p>

<ol start="2">
<li>If class B was private, could C access element and get()?</li>
</ol>