0
getting an error
8 Antworten
+ 2
Preet Check your return type of method addition. Here you have returned Class actually it should return String.
Update this method
public Realnumber addition(Realnumber s)
with this
public String addition(Realnumber s)
+ 2
Now I got it. The method addition of type Realnumber returns a new object and with the help of System.out.println
I am calling the toString method, which prints the value of r
+ 1
Preet Why RealNumber if you are returning String in your toString method.
You are returning addition of two number not class.
+ 1
Thank you Denise
0
Can somebody please tell me how to solve this problem?
0
The return type of the method should be of type Realnumber
0
Preet Yep, you got it :)