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

北京网站建设厂家福田蒙派克二手车

北京网站建设厂家,福田蒙派克二手车,wordpress小工具文本加图片代码,自己做网站升seo1.static 修饰符应用范围 static修饰符只能用来修饰类中定义的成员变量、成员方法、代码块以及内部类(内部类有专门章节进行讲解)。 2.static 修饰成员变量 static 修饰的成员变量称之为类变量。属于该类所有成员共享。 示例 package cn.lyxq.test04;public class Chinese…1.static 修饰符应用范围 static修饰符只能用来修饰类中定义的成员变量、成员方法、代码块以及内部类(内部类有专门章节进行讲解)。 2.static 修饰成员变量 static 修饰的成员变量称之为类变量。属于该类所有成员共享。 示例 package cn.lyxq.test04;public class ChinesePeople {private String name;private int age;public static String country 中国;public ChinesePeople(String name,int age){this.name name;this.age age;}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;} } package cn.lyxq.test04;public class ChinesePeopleTest {public static void main(String[] args) {ChinesePeople cp1 new ChinesePeople(张三,20);System.out.println(ChinesePeople.country);ChinesePeople.country日本;ChinesePeople cp2 new ChinesePeople(李四,30);System.out.println(ChinesePeople.country);ChinesePeople cp3 new ChinesePeople(王五,32);System.out.println(ChinesePeople.country);}} 如果类变量是公开的那么可以使用 类名.变量名 直接访问该类变量 3.static 修饰成员方法 static 修饰的成员方法称之为类方法属于该类所有成员共享。 package cn.lyxq.test04;public class ChinesePeople {private String name;private int age;private static String country 中国;public ChinesePeople(String name,int age){this.name name;this.age age;}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;}//类方法public static String getCountry() {return country;}//类方法public static void setCountry(String country) {ChinesePeople.country country;} } package cn.lyxq.test04;public class ChinesePeopleTest {public static void main(String[] args) {ChinesePeople cp1 new ChinesePeople(张三,20);ChinesePeople.setCountry(日本);ChinesePeople cp2 new ChinesePeople(李四,30);System.out.println(ChinesePeople.getCountry());ChinesePeople cp3 new ChinesePeople(王五,32);System.out.println(cp3.getCountry());//不是最优访问方式}} 如果类方法是公开的那么可以使用 类名.方法名直接访问该类方法。 4.static 修饰代码块 static 修饰的代码块被称为静态代码块在JVM第一次记载该类时执行。因此静态代码代码块只能执行一次通常用于一些系统设置场景。 package cn.lyxq.test04;public class ChinesePeople {private String name;private int age;//使用static修饰的成员变量称为类变量不会随着成员变化而变化属于所有成员共享private static String country ;//static修饰的代码块称为静态代码块在JVM第一次加载该类的时候执行只能执行一次static{country 中国;System.out.println(country属性已经被赋值);}public ChinesePeople(String name,int age){this.name name;this.age age;}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;}//类方法public static String getCountry() {return country;}//类方法public static void setCountry(String country) {ChinesePeople.country country;} } package cn.lyxq.test04.test;import cn.lyxq.test04.ChinesePeople;public class ChinesePeopleTest {public static void main(String[] args) {ChinesePeople cp new ChinesePeople(张三,20);}} 5.static内存
http://www.w-s-a.com/news/801345/

相关文章:

  • 在线网站备案站长seo综合查询工具
  • 网站根 html网站建设行业数据
  • 网站公司做的网站有最字设计说明室内设计
  • 在线网站代码生成我想做个百度网站怎么做
  • 网站的建设费用分为长治市建设厅官方网站
  • 做网站都有哪些费用建设免费手机网站
  • 网站 组成代码做网站图片怎么插
  • 2020中国企业500强榜单南宁seo标准
  • 北美购物网站排名烟台专业的网站建站公司
  • 门户网站设计特点营销策划咨询机构
  • 天津做网站就到徽信xiala5中国营销型网站
  • 外汇网站建设制作深圳三站合一网站建设
  • 深圳坂田网站设计公司有哪些学校网站建设管理办法
  • 太原建设银行网站中山营销型网站设计
  • 广东省建设厅官方网站多少钱江苏省江建集团有限公司建设网站
  • 网站开发主流服装网站开发课程设计
  • 在iis里面创建网站wordpress响应式视频
  • 学设计哪个网站好网页设计音乐网站
  • 可以自己做斗图的网站上海模板建站多少钱
  • 山东川畅信息技术有限公司网站建设网站开发任务书
  • 网站排版设计欣赏搭建公司介绍网站
  • 网站弹窗是怎么做的长沙智优营家
  • 手机网站菜单设计模板菜单网站图片素材
  • 浙江网站推广爱企查企业查询入口
  • 公司网站平台vs2012网站开发课程设计
  • 哪些方法可以建设网站做网站失败
  • 龙岗网站建设技术wordpress左右两栏
  • 电子商务网站开发与应用的介绍怎么查询域名是否备案
  • 想做一个自己设计公司的网站怎么做的权威发布型舆情回应
  • 做ppt用的音效网站python基础教程网易