Hello guys i am little much confused about return type in java. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hello guys i am little much confused about return type in java.

In my view that return type is a value which we can pass with method is this right or wrong please answer me.

20th Mar 2018, 12:23 AM
Code Race
Code Race - avatar
2 Answers
+ 13
The return type is the type of value which is returned from the function to the source of the function call. int test() { return 3; } public static void main(String[] args) { System.out.print(test()); // prints 3 }
20th Mar 2018, 12:29 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
The return type is the type of data that the method returns. The arguments are what you can pass in to the method. The return type and arguments can be different data types
20th Mar 2018, 12:36 AM
Daniel Prodrick
Daniel Prodrick - avatar