0
please.... give an example of a returnable data type function
3 Answers
+ 3
You can return data of any type.
Example: a foo() function returning an integer:
public static int foo() {
return 42;
}
0
int sum(int a, int b)"{return a + b}
int result = sum(4, 6);
0
class MyClass {
static int sum(int val1, int val2) {
return val1 + val2;
}
public static void main(String[ ] args) {
System.out.println(sum(5, 5));
}
}



