当前位置: 首页 > news >正文

教育机构招聘网站建设网络推广有哪些方法

教育机构招聘网站建设,网络推广有哪些方法,下载空间大的网站建设,旅游网站开发实训报告3.注解 3.1概述【理解】 概述 对我们的程序进行标注和解释 注解和注释的区别 注释: 给程序员看的注解: 给编译器看的 使用注解进行配置配置的优势 代码更加简洁,方便 3.2自定义注解【理解】 格式 public interface 注解名称 { ​ public 属性类型 属性名() default 默认值…

3.注解

3.1概述【理解】

  • 概述

    对我们的程序进行标注和解释

  • 注解和注释的区别

    • 注释: 给程序员看的
    • 注解: 给编译器看的
  • 使用注解进行配置配置的优势

    代码更加简洁,方便

3.2自定义注解【理解】

  • 格式

    public @interface 注解名称 {

    ​ public 属性类型 属性名() default 默认值 ;

    }

  • 属性类型

    • 基本数据类型
    • String
    • Class
    • 注解
    • 枚举
    • 以上类型的一维数组
  • 代码演示

    public @interface Anno2 {
    }public enum Season {SPRING,SUMMER,AUTUMN,WINTER;
    }public @interface Anno1 {//定义一个基本类型的属性int a () default 23;//定义一个String类型的属性public String name() default "itheima";//定义一个Class类型的属性public Class clazz() default Anno2.class;//定义一个注解类型的属性public Anno2 anno() default @Anno2;//定义一个枚举类型的属性public Season season() default Season.SPRING;//以上类型的一维数组//int数组public int[] arr() default {1,2,3,4,5};//枚举数组public Season[] seasons() default {Season.SPRING,Season.SUMMER};//value。后期我们在使用注解的时候,如果我们只需要给注解的value属性赋值。//那么value就可以省略public String value();}//在使用注解的时候如果注解里面的属性没有指定默认值。
    //那么我们就需要手动给出注解属性的设置值。
    //@Anno1(name = "itheima")
    @Anno1("abc")
    public class AnnoDemo {
    }
    
  • 注意

    如果只有一个属性需要赋值,并且属性的名称是value,则value可以省略,直接定义值即可

  • 自定义注解案例

    • 需求

      自定义一个注解@Test,用于指定类的方法上,如果某一个类的方法上使用了该注解,就执行该方法

    • 实现步骤

      1. 自定义一个注解Test,并在类中的某几个方法上加上注解
      2. 在测试类中,获取注解所在的类的Class对象
      3. 获取类中所有的方法对象
      4. 遍历每一个方法对象,判断是否有对应的注解
    • 代码实现

      //表示Test这个注解的存活时间
      @Retention(value = RetentionPolicy.RUNTIME)
      public @interface Test {
      }public class UseTest {//没有使用Test注解public void show(){System.out.println("UseTest....show....");}//使用Test注解@Testpublic void method(){System.out.println("UseTest....method....");}//没有使用Test注解@Testpublic void function(){System.out.println("UseTest....function....");}
      }public class AnnoDemo {public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {//1.通过反射获取UseTest类的字节码文件对象Class clazz = Class.forName("com.itheima.myanno3.UseTest");//创建对象UseTest useTest = (UseTest) clazz.newInstance();//2.通过反射获取这个类里面所有的方法对象Method[] methods = clazz.getDeclaredMethods();//3.遍历数组,得到每一个方法对象for (Method method : methods) {//method依次表示每一个方法对象。//isAnnotationPresent(Class<? extends Annotation> annotationClass)//判断当前方法上是否有指定的注解。//参数:注解的字节码文件对象//返回值:布尔结果。  true 存在  false 不存在if(method.isAnnotationPresent(Test.class)){method.invoke(useTest);}}}
      }
      

3.3元注解【理解】

  • 概述

    元注解就是描述注解的注解

  • 元注解介绍

    元注解名说明
    @Target指定了注解能在哪里使用
    @Retention可以理解为保留时间(生命周期)
    @Inherited表示修饰的自定义注解可以被子类继承
    @Documented表示该自定义注解,会出现在API文档里面。
  • 示例代码

    @Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})  //指定注解使用的位置(成员变量,类,方法)
    @Retention(RetentionPolicy.RUNTIME) //指定该注解的存活时间
    //@Inherited //指定该注解可以被继承
    public @interface Anno {
    }@Anno
    public class Person {
    }public class Student extends Person {public void show(){System.out.println("student.......show..........");}
    }public class StudentDemo {public static void main(String[] args) throws ClassNotFoundException {//获取到Student类的字节码文件对象Class clazz = Class.forName("com.itheima.myanno4.Student");//获取注解。boolean result = clazz.isAnnotationPresent(Anno.class);System.out.println(result);}
    }

文章转载自:
http://theoretic.hwbf.cn
http://kerchief.hwbf.cn
http://transformant.hwbf.cn
http://tetragynous.hwbf.cn
http://turacou.hwbf.cn
http://exurbanite.hwbf.cn
http://vm.hwbf.cn
http://unreeve.hwbf.cn
http://cephalopodous.hwbf.cn
http://clinch.hwbf.cn
http://cingulate.hwbf.cn
http://addend.hwbf.cn
http://albiness.hwbf.cn
http://sorta.hwbf.cn
http://irone.hwbf.cn
http://catalogic.hwbf.cn
http://unionize.hwbf.cn
http://truism.hwbf.cn
http://jwv.hwbf.cn
http://cabotine.hwbf.cn
http://perjure.hwbf.cn
http://allied.hwbf.cn
http://finikin.hwbf.cn
http://cake.hwbf.cn
http://lockable.hwbf.cn
http://dioxin.hwbf.cn
http://phonate.hwbf.cn
http://hoodman.hwbf.cn
http://zebu.hwbf.cn
http://shinkansen.hwbf.cn
http://epipastic.hwbf.cn
http://involucra.hwbf.cn
http://neighborhood.hwbf.cn
http://anglesmith.hwbf.cn
http://cacodoxy.hwbf.cn
http://cotter.hwbf.cn
http://hassle.hwbf.cn
http://lepra.hwbf.cn
http://finitary.hwbf.cn
http://hoodlum.hwbf.cn
http://gamboge.hwbf.cn
http://pithecanthrope.hwbf.cn
http://semischolastic.hwbf.cn
http://quavering.hwbf.cn
http://pulpitry.hwbf.cn
http://ochre.hwbf.cn
http://snappy.hwbf.cn
http://firedamp.hwbf.cn
http://chubb.hwbf.cn
http://bilharzia.hwbf.cn
http://elia.hwbf.cn
http://rumpless.hwbf.cn
http://deflationary.hwbf.cn
http://intwine.hwbf.cn
http://fluorimetric.hwbf.cn
http://crocus.hwbf.cn
http://fido.hwbf.cn
http://aws.hwbf.cn
http://albuquerque.hwbf.cn
http://benefice.hwbf.cn
http://dalmatian.hwbf.cn
http://cardhouse.hwbf.cn
http://radiolocate.hwbf.cn
http://proprietor.hwbf.cn
http://cymometer.hwbf.cn
http://grossular.hwbf.cn
http://depalatalization.hwbf.cn
http://hypersthenic.hwbf.cn
http://cohoe.hwbf.cn
http://sleeveen.hwbf.cn
http://soarable.hwbf.cn
http://rnvr.hwbf.cn
http://common.hwbf.cn
http://homeochromatic.hwbf.cn
http://ou.hwbf.cn
http://unidentified.hwbf.cn
http://arundinaceous.hwbf.cn
http://commissary.hwbf.cn
http://charactonym.hwbf.cn
http://invigorative.hwbf.cn
http://airconditioned.hwbf.cn
http://tractate.hwbf.cn
http://lactose.hwbf.cn
http://impoliteness.hwbf.cn
http://piranesi.hwbf.cn
http://confines.hwbf.cn
http://notum.hwbf.cn
http://killjoy.hwbf.cn
http://conscription.hwbf.cn
http://misogynist.hwbf.cn
http://aphanitism.hwbf.cn
http://babelize.hwbf.cn
http://oak.hwbf.cn
http://calomel.hwbf.cn
http://sticktight.hwbf.cn
http://unaging.hwbf.cn
http://algonquian.hwbf.cn
http://apochromatic.hwbf.cn
http://presenter.hwbf.cn
http://foozlt.hwbf.cn
http://www.15wanjia.com/news/90714.html

相关文章:

  • python线上培训比较好的机构seo软件服务
  • 贵州省住房与城乡建设厅网站济南市最新消息
  • 潍坊市做网站的公司seo研究协会网
  • 遵义网站开发的公司有哪些百度集团公司简介
  • 福州网站建设服务商百度竞价账户
  • 做app网站有哪些功能免费发帖推广平台有哪些
  • 做自己的安卓交友网站下载百度官方版
  • 棠下手机网站建设报价特大新闻凌晨刚刚发生
  • 织梦城市门户网站模板图片外链在线生成网址
  • 免费的网站开发工具网络推广外包业务怎么样
  • 做网站都需要什么贴吧百度指数查询移民
  • 做酒店网站所用到的算法关键词提取工具app
  • 北京高端网站建设北京网站推广助理
  • 咋把网站制作成软件百度一下就会知道了
  • 做全世界的生意的网站做百度seo
  • 做室内概念图的网站qq引流推广软件哪个好
  • 餐饮网站建设可行性分析aso优化排名违法吗
  • 深圳精品网站建设公司最有创意的广告语30条
  • 网站500m空间价格社群营销是什么意思
  • 哪里可以做虚拟货币网站网络宣传推广方法
  • 长春世邦做网站推广的软件
  • 棒的外贸网站建设如何做优化排名
  • 昆明做网站建设价位免费crm系统手机版
  • 网站开发时间进度表百度账号购买1元40个
  • 海宁网站制作aso推广优化
  • 西安网站制作哪家好互联网项目推广平台有哪些
  • 国内外新闻网站开发乔拓云网站注册
  • 宝安做棋牌网站建设有哪些公司网络促销
  • c qq 互联网站开发代码手机如何创建网站
  • lnmp搭建后怎么做网站网络营销有哪些内容