class A
{
int i,j;
void showij()
{ System.out.println(i+j);
}
}
class B extends A
{
int k;
void showk()
{
System.out.println(k);
}
void sum()
{
System.out.println(i+j+k);
}
}
class test6
{
public static void main(String arg[])
{
A t = new A();
B t1 = new B();
t.i = 10; t.j =20;
t.showij();
t1.i = 15; t1.j =25; t1.k = 35;
t1.showij();
}
} Java
Java - Single Inheritance concept.

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
