getting an error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
15th Dec 2019, 2:18 PM
Preet
8 Answers
+ 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)
15th Dec 2019, 2:41 PM
A͢J
A͢J - avatar
+ 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
15th Dec 2019, 7:06 PM
Preet
+ 1
Preet Why RealNumber if you are returning String in your toString method. You are returning addition of two number not class.
15th Dec 2019, 2:53 PM
A͢J
A͢J - avatar
15th Dec 2019, 4:56 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Thank you Denise
15th Dec 2019, 7:08 PM
Preet
0
Can somebody please tell me how to solve this problem?
15th Dec 2019, 2:19 PM
Preet
0
The return type of the method should be of type Realnumber
15th Dec 2019, 2:44 PM
Preet
0
Preet Yep, you got it :)
15th Dec 2019, 7:07 PM
Denise Roßberg
Denise Roßberg - avatar