假设我有一些代码:publicintdoSomething(intx){otherMethod(x);System.out.println("otherMethodiscomplete.");return0;}publicvoidotherMethod(inty){//methodbody}既然otherMethod的返回类型是void,doSomething方法如何知道otherMethod何时完成,所以它可以转到下一个like并打印“otherMethod完成了。”?编辑:将return0;添加到doSomething方法中,以便示例代码可以编译。 最佳