Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am stuck with the toString method of all classes please help By using Java Example of one of the classes: public class Add {
I am stuck with the toString method of all classes
please help
By using Java
Example of one of the classes:
public class Add {
private int num1 ;
private int num2;
public Add (int num1 , int num2)
{
this.num1 = num1 ;
this.num2 = num2 ;
}
public void setNum1 (int num1)
{
num1 =num1;
}
public void setNum2 (int num2)
{
num2 =num2;
}
public int getNum1 ()
{
return num1;
}
public int getNum2 ()
{
return num2;
}
public int addCal(int addResult)
{
return addResult = num1 + num2;
}
}
Add - num1:int - num2:int NumberDemo + main(args String[I) :void + toString0:String + sumO int Sub - num1 int - num2:int + toString():String + sub()int Number add: Addition -mul: Mul -sub: Sub +toString(): String +Number) Mul - num1: int - num2: int +tostring():String + mul():intStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started