Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我想使用方法 A 的返回值作为 java 中方法 B 的参数,我该怎么做呢?例如,方法 A 返回今天是晴天还是阴天,而方法 B 则查找该月中晴天的百分比。
试试这个方法...
public void chkIt(doIt()){ System.out.println(doIt()); // But then you will unnecessarily call it twice. } public boolean doIt(){ return true; }