0

Can we have different method types for the main method and its parameters?

Referring to the following code: static int sum(int val1, int val2) { return val1 + val2; } Could it be that the sum was a String but the values were int? I cannot think of an example where it would work but is it possible?

6th Jan 2017, 12:29 AM
Kalipso Bznuni
Kalipso Bznuni - avatar
1 Answer
0
I think it is possible, I'm not super-familiar with java, but some languages have a function called "stringify", or you can have the result go to a variable and type cast it to a string
6th Jan 2017, 12:38 AM
Ethan