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

广州 网站 建设seo服务公司怎么收费

广州 网站 建设,seo服务公司怎么收费,公司网站建设浩森宇特,房产网站系统源码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/111049.html

相关文章:

  • 自己做提卡网站seo排名赚钱
  • .net mvc做网站天津seo推广软件
  • 网站数据库怎么配置东莞百度seo推广公司
  • 海城网站建设班级优化大师官网下载
  • 商城类网站用什么做百度指数查询app
  • 做视频比较好的理财网站有哪些搜索热词排名
  • 网站建设教程公司关键词seo
  • 银川网站建设广告接单平台app
  • 上海企业网站建设公司哪家好免费的网络推广平台
  • 宁波建网站报价seo诊断方案
  • wordpress英文企业主题seo在线推广
  • 老师让做网站怎么做合肥seo优化排名公司
  • 郑州网站推广方法武汉网站维护公司
  • 如何查询手机注册的网站长沙线上引流公司
  • 企业网站建设合同书标准版百度视频免费下载
  • 带积分的网站建设怎么创建一个网址
  • java做网站连sqlsever收录网
  • 网站建设教程 零基础搜索引擎优化是免费的吗
  • 邯郸做网站公司哪家好seo词条
  • 金融公司网站 html襄阳seo推广
  • 域名 网站产品推广营销方案
  • 电子商务网站的特点制作一个简单的html网页
  • 百度网站的优缺点微博推广怎么做
  • 花都网站建设公司天蝎信息网站统计分析工具的主要功能
  • 做网站用的书百度商家
  • 大兴做网站公司淘宝直通车推广怎么做
  • 免费建立自己的网站如何搭建一个网站
  • 乌鲁木齐 网站建设seo常用工具
  • 做网站有什么短视频seo排名系统
  • 网站统计访客数量怎么做郑州seo推广外包