Overloading java question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Overloading java question

is this code consider a overloading code?why is it not running? https://code.sololearn.com/c9Ih55tKg1hw/?ref=app

24th Oct 2017, 6:14 AM
oyl
7 Answers
+ 8
Yeah, it's correct. Keep it up :)
24th Oct 2017, 6:37 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
method's return type can't be both void and int at the same time. Make them only void, erase int and double from method signatures.
24th Oct 2017, 6:34 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 3
Yes, overloading is defined as using a method with the exact same method name within the same class in which each overloaded method has a different number and/or type of parameter(s). The return type doesn't matter.
24th Oct 2017, 6:39 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You have your function return types as double and int, yet they are not returning any value. If you want to return a value then you need to add the return statements to each function, otherwise change the functions return types to void.
24th Oct 2017, 6:27 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You need to change them to void, not void double and void int, just void.
24th Oct 2017, 6:31 AM
ChaoticDawg
ChaoticDawg - avatar
0
i have added void but it is still not working
24th Oct 2017, 6:30 AM
oyl
0
thankyou all.i forgot about this.btw did i use overloading correctly here?
24th Oct 2017, 6:35 AM
oyl