What does the return keyword do in a void method in Java?

后端 未结 7 1570
Happy的楠姐
Happy的楠姐 2020-11-28 21:34

I\'m looking at a path finding tutorial and I noticed a return statement inside a void method (class PathTest, line 126):



        
7条回答
  •  失恋的感觉
    2020-11-28 22:25

    It exits the function and returns nothing.

    Something like return 1; would be incorrect since it returns integer 1.

提交回复
热议问题