D.java

package mypackage;

class C
{
   int c_int;
   private int c_private_int;
   protected int c_protected_int;
   public int c_public_int;
   static int c_static_int = 100;
   private static int c_private_static_int = 101;
   protected static int c_protected_static_int = 102;
   public static int c_public_static_int = 103;

   C (int x)
   {
      c_int = x;
      c_private_int = x+1;
      c_protected_int = x+2;
      c_public_int = x+3;
   }
   
   public int c() { return c_int; }
   public int c_private() { return c_private_int; }
   public int c_protected() { return c_protected_int; }
   public int c_public() { return c_public_int; }
   public int c_static() { return c_static_int; }
   public int c_private_static() { return c_private_static_int; }
   public int c_protected_static() { return c_protected_static_int; }
   public int c_public_static() { return c_public_static_int; }   
   
   int D_c_static() { return D.c_static_int; }

   int D_c_protected_static() { return D.c_protected_static_int; }
   int D_c_public_static() { return D.c_public_static_int; }   
   int D_c() { return D.c_int; }
   int D_c_private() { return D.c_private_int; }
   int D_c_protected() { return D.c_protected_int; }
   int D_c_public() { return D.c_public_int; }   
}

public class D extends C
{
   static int c_static_int = 110;
   private static int c_private_static_int = 111;
   protected static int c_protected_static_int = 112;
   public static int c_public_static_int = 113;

   // Must be public or else it is not seen (cannot be protected)
   public  D (int x) { super(x); }
   
   // Must be public to view outside of package (cannot be protected)
   public int d() { return c_int; }
   // Variable c_private_int in class C not accessible from class D
   // public int d_private() { return c_private_int; }
   public int d_protected() { return c_protected_int; }
   public int d_public() { return c_public_int; }
   public int d_static() { return c_static_int; }
   public int d_private_static() { return c_private_static_int; }
   public int d_protected_static() { return c_protected_static_int; }
   public int d_public_static() { return c_public_static_int; }
}