// Program
import
java.util.Scanner;
public
class Parent
{
protected int a;
public void P()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter any
integer value");
a=sc.nextInt();
}
}
import
java.util.Scanner;
public
class Child extends Parent
{
protected int b;
public void C()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter any
other integer value");
b=sc.nextInt();
System.out.println("Sum="+(a+b));
}
public static void main(String args[])
{
Child obj=new Child();
obj.P();
obj.C();
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.