class Sum
{
                int a,b;
                void getData(int x,int y)
                {
                                a=x;
                                b=y;
                }
                int outData()
                {
                                int s=a+b;
                                return (s);
                }
}
class Calculate
{
                public static void main(String args[])
                {
                                int c;
                                Sum ss=new Sum();
                                ss.getData(15,25);
                                c=ss.outData();
                                System.out.println("Sum = "+c);
                }
}

JAVA 13.PNG

Advertisements