在上 https://gist.github.com/bernii/5697073在匿名內部類中調用方法是什麼?
在代碼
this.wait.until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver webDriver) {
System.out.println("Searching ...");
return webDriver.findElement(By.id("resultStats")) != null;
}
});
什麼叫在匿名內部類的應用()方法的示例程序?
這只是我自己,但重寫時注意覆蓋方法時@Override。儘管你和我都知道你重寫了'apply(WebDriver webDriver)'方法,但標記註釋對於顯示你知道你重寫了一個方法很重要,並且你知道這是一個將被調用的方法。 –