title: Private Access Specifier usage in Java Inheritance
body: <p>We can access the Super Class methods which consists of operations on private data members and  print the results.But why can't I print the private data members of Super Class with the SubClass object calling them in my main function? Someone please explain me. </p>
  
  <p>Here is the example below.</p>
  
  <pre><code>class SuperClass1
  {
      private int a;
      private int b;
  
      SuperClass1(int p,int q)
      {
          a=p;
          b=q;
      }
      SuperClass1(SuperClass1 obj)
      {
          a=obj.a;
          b=obj.b;
      }
      SuperClass1()
      {
          a=-1;
          b=-1;
      }
  
      int Vol()
      {
          return a*b;
      }
  }
  
  class SubClass1 extends SuperClass1
  {
      int c;
  
      SubClass1(int p,int q,int r)
      {
          super(p,q);
          c=r;
      }
      SubClass1(SubClass1 obj)
      {
          super(obj);
          c=obj.c;
      }
      SubClass1()
      {
          super();
          c=-1;
      }
  }
  
  
  public class Super 
  {
      public static void main(String[] args) 
      {
          SubClass1 obj1=new SubClass1();
          //System.out.println("The values of obj1 are:"+obj1.a+""+obj1.b+""+obj1.c);
          int vol=obj1.Vol();
          System.out.println("The volume is :"+vol);
      }
  }
  </code></pre>