Tuesday, 10 June 2014

Inheritance Example

class A
{
  int a = 10;
void show()
{
  System.out.println("Base class Var="+a);
}
}
class Inherit
{
int a = 20;
  void show()
{
  System.out.println("Inheriting class Var="+a);
}
public static void main(String []args)
{
  Inherit ob = new Inherit();
  ob.show();
}
}

No comments:

Post a Comment