@override annotation

后端 未结 6 1128
别跟我提以往
别跟我提以往 2021-01-17 11:57

Can anyone tell me if this code:

public class OvTester {
    @Override
    public int hashCode() {
        return toString().hashCode();
    }
}
6条回答
  •  情歌与酒
    2021-01-17 12:16

    @Override is just compile time check if the implementer really overrides the method.

    if you try overriding

    @Override
    public void equals(Object ob){
    
    }
    

    it will fail to compile

提交回复
热议问题