+ 1

can anybody tell me the complete description of this program?

public static void add(number a,number b) { number c= a.add(b); c.display(); }

9th Feb 2017, 4:17 PM
Pooja Upadhyay
Pooja Upadhyay - avatar
6 ответов
+ 2
How do you know it's intended to be the same method? I think they are different methods. number is a class or struct with a badly designed name (start with uppercase for clearancy) and has method add which accepts another object instance of the same type, does some hidden magic inside of it and returns a result which is also of type "number". It seems that this class/struct has a display method as well which probably outputs something from it.
9th Feb 2017, 4:33 PM
Zilvinas Steckevicius
Zilvinas Steckevicius - avatar
0
what does number indicate here .. please specify that
9th Feb 2017, 4:29 PM
Jasmeetsingh Bansal
Jasmeetsingh Bansal - avatar
0
it is recursion as you are calling add func in add fucn ....With no termination Condition (base condition) ..if add method is in Number class ...so that It become infinte calling of function...
9th Feb 2017, 4:31 PM
Shreyance Gupta
Shreyance Gupta - avatar
0
actually i m trying to make interface .so this will act as a refrencing party
9th Feb 2017, 4:35 PM
Pooja Upadhyay
Pooja Upadhyay - avatar
0
can we create a struct in java??
9th Feb 2017, 4:36 PM
Jasmeetsingh Bansal
Jasmeetsingh Bansal - avatar
0
most probably you are using overloading in this case.. if you want the working submit the code for add method that takes a number argument and outputs a number object type..considering number is a class name ...it's better if you obey java rules while defining classes
9th Feb 2017, 4:41 PM
Jasmeetsingh Bansal
Jasmeetsingh Bansal - avatar