Annotations_JDK anotaciones integradas

Algunas anotaciones predefinidas en el JDK

  •  * @Override	:检测被该注解标注的方法是否是继承自父类(接口)的
    
  •  * @Deprecated:该注解标注的内容,表示已过时
    
  •  * @SuppressWarnings:压制警告
    
  •  	 一般传递参数all  @SuppressWarnings("all")
    

Ejemplo:

@SuppressWarnings("all")
public class AnnoDemo2 {
    
    
    @Override
    public String toString() {
    
    
        return super.toString();
    }

    @Deprecated
    public void show1(){
    
    
        //有缺陷
    }


    public void show2(){
    
    
        //替代show1方法
    }

    public void demo(){
    
    
        show1();
        Date date = new Date();
    }
}

programa:
Inserte la descripción de la imagen aquí

Supongo que te gusta

Origin blog.csdn.net/weixin_44664432/article/details/109238878
Recomendado
Clasificación