0
give a method a type
hey, i didnt understand how you can give a method a type.... for example: int div(){ } does the int says whats the returned var or what?
3 Answers
+ 1
it's simple. Ex:I want to return the sum of two numbers type double, I would do... double sum = double returnSum(2.3, 3.7);
The method: double returnSum(double a, double b){return a + b}
+ 1
thx
0
Correct: double sum = returnSum(2.3, 3.7);