可能重複:
When do you use Java's @Override annotation and why?
Java, What does @Override mean?@Override在此Java代碼中的含義是什麼?
我被檢查出Drools的規劃師實例源代碼,我遇到的代碼來是這樣的:
@Override
protected Solver createSolver() {
XmlSolverConfigurer configurer = new XmlSolverConfigurer();
configurer.configure(SOLVER_CONFIG);
return configurer.buildSolver();
}
protected Solver createSolverByApi() {
// Not recommended! It is highly recommended to use XmlSolverConfigurer with an XML configuration instead.
SolverConfig solverConfig = new SolverConfig();
solverConfig.setSolutionClass(NQueens.class);
.....TRUNCATED....
solverPhaseConfigList.add(localSearchSolverPhaseConfig);
solverConfig.setSolverPhaseConfigList(solverPhaseConfigList);
return solverConfig.buildSolver();
}
由於據我所知當你明確地調用它們時,createSolver()
和createSolverByApi()
應該返回Solver對象。
@Override
這是什麼意思? @術語的一般含義是什麼?
編輯:我很不好;我無意中複製了What does @Override mean?
至少可以使* *一些企圖在閱讀文檔... http://docs.oracle .com/javase/6/docs/api/java/lang/Override.html – skaffman 2012-01-16 07:35:34