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

后端 未结 7 1567
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条回答
  •  -上瘾入骨i
    2020-11-28 22:24

    It functions the same as a return for function with a specified parameter, except it returns nothing, as there is nothing to return and control is passed back to the calling method.

提交回复
热议问题