import java.io.*;
class xyz
{
int x,y;
void get() throws IOException
{
BufferedReader br= new BufferedReader( new InputStreamReader (System.in));
System.out.print("Enter a num : ");
x=Integer.parseInt(br.readLine());
System.out.print("Enter a num : ");
y=Integer.parseInt(br.readLine());
}
}
class abc extends xyz
{
int a;
void calc()
{
a=x+y;
System.out.println("The sum of "+x+" & "+y+" is "+ a);
}
}
class mno extends abc
{
int s;
void disp()
{
s=x-y;
System.out.println("Difference : "+ s);
}
}
class inheritance
{
public static void main(String[] args) throws IOException
{
mno d= new mno();
d.get();
d.calc();
d.disp();
}
}
0 comments:
Post a Comment