/*****************************************************/
// INHERIT1
// Original author: David Schwartz, dis@cs.cornell.edu
// Updated by: Kiri Wagstaff, wkiri@cs.cornell.edu
// The following code demonstrates how a subclass
// inherits public instance variables and methods 
// from a superclass.

// We can have multiple non-public classes inside one
// class file, but only one public class.
class A 
{
    public int x = 1;
    public void sayHi() 
    {
	      System.out.println("Hi! x = "+x);
    }
}

class B extends A 
{ 
  // No need to rewrite x and sayHi()!
  // They're automatically inherited from class A.
}

// This is the public class, and the one we set the Target to.
public class Inherit1 
{
    public static void main(String[] args) 
    {
    	B b = new B();
    	b.sayHi();
    }
}

/* output:
   Hi! x = 1
*/
