java中的常见注解

jdk自带注解:@Override 覆盖  @Deprecated 过期  @Suppvisewarnings 压制警告

 

package com.tsh.ano;

public class AnoDemo {
    
    public static void main(String[] args) {
        Person person=new Student();
        person.getName();
        //下面会有一个删除线
        person.sing();
    }
}
interface Person{
    public String getName();
    //这个注解表示 过期
    @Deprecated
    public void sing();
}
class Student implements Person{
    //这个注解表示 覆盖
    @Override
    public String getName() {
        return null;
    }

    @Override
    public void sing() {
        
    }
}

 

相关文章:

  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-03-02
  • 2022-01-09
  • 2022-03-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-10-30
  • 2021-08-01
  • 2021-08-25
  • 2021-11-29
相关资源
相似解决方案