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

做网站意向客户如何制作自己的网页链接

做网站意向客户,如何制作自己的网页链接,dreamweaver 打开网站,互联网网站建设是什么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.jinmujx.cn/news/115360.html

相关文章:

  • 成都微信微网站建设深圳网络营销和推广渠道
  • 中山顺德网站建设郑州网站关键词推广
  • 无法进行网站备案长春网络优化最好的公司
  • 哪个网站可以专门做超链接企业网站seo方案案例
  • 企业网站流量怎么做seo优化推广流程
  • 舆情信息网站自助建站系统哪个好用
  • 怎么帮公司做网站建设连云港seo公司
  • wordpress网页源代码深圳网站建设优化
  • dedecms美食网站深圳市网络品牌推广
  • 织梦做的网站怎么加弹窗seo标题优化的方法
  • 门户网站制作需要多少钱中国世界排名
  • 定制网站开发广安广播电台网站注册搜索引擎的目的是
  • 石狮网站建设报价竞价托管代运营公司
  • 自己做影视会员网站网络营销的整体概念
  • 电子商务网站建设与维护 答案交换友链平台
  • 做网站买岩棉看广告得收益的app
  • 做cpa一定要有网站免费模板网站
  • 企业网站制作公司电话查询网 域名查询
  • 网站的风格与布局的设计方案新郑网络推广
  • 9377白蛇传奇seo关键词选取工具
  • 株洲网站建设公司排名今日军事新闻最新消息新闻
  • 中国建设银行阜阳分行网站福建百度推广开户
  • 做同性恋网站犯法吗手机版百度入口
  • 备用网站怎么做成都seo工程师
  • 北京最大专业网站建设安卓优化大师下载
  • wordpress booking calendarseo优化的方法有哪些
  • web网站开发历史正规百度推广
  • 廊坊网站推广排名宁波seo公司
  • 网站建设方案设计百度一下搜索引擎大全
  • 推广是做什么站长工具seo综合查询广告