Sunday, May 26, 2013

Inheritance in Java

/**Program For Inheritance in Java**/


import java.lang.*;

class xyz
  {
       int x;
     
public void getdata()
  {
    x=5;
  }
public void putdata()
 {
   System.out.println(x);
 }
  }

class abc extends xyz
  {
       int a;

public void getdata()
{
  a=7;
}
public void putdata()
{
  System.out.println(a);
}

public static void main(String args[])throws Exception
    {  
abc a=new abc();
xyz x=new xyz();

         

x.getdata();
a.getdata();
x.putdata();
a.putdata();
 }
  }

No comments:

Post a Comment

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...