public class cal
{
public int no1;
public int no2;
public int Add()
{
return(no1+no2);
}
public int Sub()
{
return(no1-no2);
}
cal()
{
no1=20;
no2=10;
}
cal(int m,int n)
{
no1=m;
no2=n;
}
}
public class Calculater
{
public static void main(String[] args)
{
cal t1=new cal();
System.out.println("The addition "+t1.no1+" and "+t1.no2+" is = "+t1.Add());
cal t2=new cal();
System.out.println("The subtraction "+t2.no1+" and "+t2.no2+" is = "+t2.Sub());
cal t3=new cal(50,30);
System.out.println("The addition "+t3.no1+" and "+t3.no2+" is = "+t3.Add());
cal t4=new cal();
System.out.println("The subtraction "+t4.no1+" and "+t4.no2+" is = "+t4.Sub());
}
}
{
public int no1;
public int no2;
public int Add()
{
return(no1+no2);
}
public int Sub()
{
return(no1-no2);
}
cal()
{
no1=20;
no2=10;
}
cal(int m,int n)
{
no1=m;
no2=n;
}
}
public class Calculater
{
public static void main(String[] args)
{
cal t1=new cal();
System.out.println("The addition "+t1.no1+" and "+t1.no2+" is = "+t1.Add());
cal t2=new cal();
System.out.println("The subtraction "+t2.no1+" and "+t2.no2+" is = "+t2.Sub());
cal t3=new cal(50,30);
System.out.println("The addition "+t3.no1+" and "+t3.no2+" is = "+t3.Add());
cal t4=new cal();
System.out.println("The subtraction "+t4.no1+" and "+t4.no2+" is = "+t4.Sub());
}
}