Physics, asked by tiwi06, 20 days ago

Explain the return statement in Java with the help of a small program.

Answers

Answered by durgasrimurugan18
1

Answer:

#include <stdio.h>

int fun()

{ int a=1;

return a;

}

void main()

{

int value=0;

printf("example for return stmt");

value=fun();

printf("return value from method fun %d",value);

}

Explanation:

return statement returns only one value to the called method ,in this example i'm using int as a return type(data type-int fun) so it only return integer value .if we want float value or char or whatever we should use that as a return type of method

Similar questions