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

怎样才能制作网站如何快速构建一个网站

怎样才能制作网站,如何快速构建一个网站,十大推广app平台,腾讯企业qq注册中心1.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/551075/

相关文章:

  • 如何做好品牌网站建设方案网站开发的学习
  • 网站开发 管理方案wordpress怎么搭建微博
  • 有哪些ui的设计网站网上商城网站建设设计方案
  • iis中怎样配置网站绑定运城可以做网站的公司
  • 品牌网站建设开发价格dedecms电影网站模板
  • 网站设计外包合同帝国网站后台认证码错误
  • 网站设计公司深圳怎么免费做公司网站
  • 90设计网站几次是什么意思swipe类网站
  • 安康微网站建设网站域名使用费用
  • 网站建设执招标评分表微信代理网站模板
  • ps做网站分辨率自适应地方网站盈利
  • 免费自助小型网站专业网站建设组织
  • 猎聘网网站建设目标查看别人wordpress主题
  • 免费建设网站入驻网站备案不能更新吗
  • 个人网站制作代码西安建筑类公司
  • 网站备案要营业执照吗网站建设如何记账
  • 新手学做网站难吗外包服务商
  • 公司网站建设的项目工作分解结构wordpress插件后端页面
  • 四川省建设人才网站2018南京专业建站
  • ppt制作网站推荐seo教程百度网盘
  • 网站建设多少钱一平米网上商城网站开发报告
  • 福州网站建设招聘信息哈尔滨中企动力科技股份有限公司
  • 军事新闻最新seo关键词查询排名软件
  • 免费网站建设官网项目建设表态发言
  • 平谷建站推广广告投放平台主要有哪些
  • 网站备案掉了什么原因步骤怎么读
  • 徐州市建设监理协会网站做一个公司官网需要多少钱
  • 网站开发学什么数据库做公司网站注意事项
  • 游戏开发网站建设国际战事最新消息
  • 达州+网站建设网站里自己怎么做推广