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

找素材去哪个网站潍坊seo网络推广

找素材去哪个网站,潍坊seo网络推广,聊城广告设计公司,web制作网页作业Java常量与变量 在程序执行过程中,其值不能被改变的量称为常量,其值能被改变的量称为变量。 Java关键字 Java关键字 int public (公有的,可跨包) new finally throw (抛出一个异常对象) continuefloatlongshort extends (继承,用于类继承类) returnbrea…

 Java常量与变量

        在程序执行过程中,其值不能被改变的量称为常量其值能被改变的量称为变量

        Java关键字

Java关键字
int

public

(公有的,可跨包)

new

finally

throw

(抛出一个异常对象)

continuefloatlongshort

extends

(继承,用于类继承类)

returnbreakfor

static

(用于声明静态成员,被类的所有实例对象共享)

do

(运行,常与while连用)

ifgotodefaultbyte

protected

(受保护的,当前包内可用)

strictfp

(严格精准)

package

(用于定义包)

super

(调用父类的方法)

void

final

(最终的不可被改变的,

final修饰的类不能被继承,

final修饰的方法不能被子类重写,final修饰的属性就是常量

)
elsecatch

implements

(实现,用于类或接口实现)

private

(限定访问权限为私有,当前类可用)

instanceof

(用于检查对象是否是特定类型的实例)

extends

(继承,用于类继承类)

volatile

(用于声明变量在多线程环境中可见)

while

synchronized

(用于同步方法或代码块,线程同步)

this

(当前类的父类的对象,调用当前类中的方法)

tryimport

transient

(用于声明字段不被序列化)

boolean

abstract

(声明抽象)

interface

(用于定义接口)

case

(返回开关里的结果)

switch

(用于多重选择语句)

class

enum

(枚举,代表一组常用常量,可用来代表一类相同类型的常量)

null

(空值)

char

native

(用于声明本地方法)

double

throws

(在执行这个方法的时候,可能产生一个异常,如果产生异常了,那么谁调用了这个方法,就抛给谁)

1 常量

        程序运行过程中一直不会改变的量称为【常量(constant)】,也被称作【final变量】,常量在整个程序中只能被赋值一次。

        Java声明一个常量除了要指定数据类型,还需通过【final】关键字进行限定,标准语法:

        final 数据类型 常量名称[=值]

//声明常量
final double PI = 3.141592D;    //声明double型常量并赋值
final boolean BOOL = false;     //声明boolean型常量并赋值

        当定义的final常量是成员变量/全局变量时,必须在定义时就赋值初始值,否则编译会报错。

public class Part {static final double PI = 3.1415d;    //声明常量PI为成员变量,如果这里不赋值,会错误提示static int age = 6;                 //声明int型并赋值变量public static void main(String[] args) {final int number;               //声明int型常量numbernumber = 1225;                  //对常量进行赋值age = 31;                       //再次对变量age进行赋值//number = 1236;                //错误代码,因为number为常量,常量只能进行一次赋值System.out.println("常量PI的值为:" + PI);System.out.println("赋值后number的值为:" + number);System.out.println("int型变量age的值为:" + age);}}输出:
常量PI的值为:3.1415
赋值后number的值为:1225
int型变量age的值为:31

2 变量

2.1 成员变量

        在类体中所定义的变量称为【成员变量/全局变量】,成员变量的作用域为整个类,类的成员变量又分为【静态变量】和【实例变量】

2.1.1 静态变量
2.1.2 实例变量
class Var{int x = 45;            //x为实例变量static int y = 90;     //y为静态变量/类变量
}

        示例中,x为实例变量,y为静态变量(也称作类变量),如果在成员变量的前面加上关键字static,这样的成员变量就称为静态变量。静态变量的有效范围可以跨类,甚至可以到达整个应用程序内,静态变量既能在定义它的类中访问使用,也能直接以【类名.静态变量名】的方式在其他类中访问使用

2.2 局部变量

        类的方法体中定义的变量(包括方法的参数)称为【局部变量】,局部变量只在当前方法代码块中有效。

        局部变量的生命周期取决于方法被调用,方法被调用时JVM为方法中的局部变量分配内存空间,当该方法调用结束后,就会释方法中放局部变量占用的内存空间。

        局部变量可与成员变量(全局变量)同名,此时成员变量将被隐藏,即这个成员变量在此方法中暂时失效。

变量的作用域   

public class Val {static int times = 3;           //定义成员变量public static void main(String[] args) {int times = 4;              //定义局部变量System.out.println("times的值为:" + times);}
}输出:
times的值为:4


文章转载自:
http://dinncoshyness.tpps.cn
http://dinncoacademese.tpps.cn
http://dinncoaffricative.tpps.cn
http://dinncobacchant.tpps.cn
http://dinncomicron.tpps.cn
http://dinncopyroligneous.tpps.cn
http://dinncopyranometer.tpps.cn
http://dinncobantu.tpps.cn
http://dinncotutorly.tpps.cn
http://dinncocrista.tpps.cn
http://dinncodeanglicize.tpps.cn
http://dinncoergatoid.tpps.cn
http://dinncocalendula.tpps.cn
http://dinncomahomet.tpps.cn
http://dinncotranquility.tpps.cn
http://dinncoallograft.tpps.cn
http://dinnconugmw.tpps.cn
http://dinncoergosterol.tpps.cn
http://dinncobaccate.tpps.cn
http://dinncooss.tpps.cn
http://dinncowoodruff.tpps.cn
http://dinnconoted.tpps.cn
http://dinncojungly.tpps.cn
http://dinncogeewhillikins.tpps.cn
http://dinncofritter.tpps.cn
http://dinncohominized.tpps.cn
http://dinncoaetna.tpps.cn
http://dinncoalguazil.tpps.cn
http://dinncoradiocompass.tpps.cn
http://dinnconovelette.tpps.cn
http://dinncoembryotroph.tpps.cn
http://dinncoepicycle.tpps.cn
http://dinncodigression.tpps.cn
http://dinncotransilluminate.tpps.cn
http://dinncoperfection.tpps.cn
http://dinncozoster.tpps.cn
http://dinncofloral.tpps.cn
http://dinncoheterogamy.tpps.cn
http://dinncoglottis.tpps.cn
http://dinncofermium.tpps.cn
http://dinncowhiplike.tpps.cn
http://dinncorevisability.tpps.cn
http://dinncopsittacosis.tpps.cn
http://dinncoambergris.tpps.cn
http://dinncosnare.tpps.cn
http://dinncomusca.tpps.cn
http://dinncoreevesite.tpps.cn
http://dinncotrig.tpps.cn
http://dinncomalleate.tpps.cn
http://dinncomegaera.tpps.cn
http://dinncotelerecord.tpps.cn
http://dinncosheepcote.tpps.cn
http://dinncoblc.tpps.cn
http://dinncosheshbesh.tpps.cn
http://dinncohecla.tpps.cn
http://dinncointractability.tpps.cn
http://dinncoteleocracy.tpps.cn
http://dinncoproconsulship.tpps.cn
http://dinncodecibel.tpps.cn
http://dinncorebuild.tpps.cn
http://dinncopandurate.tpps.cn
http://dinncoappraisal.tpps.cn
http://dinncocosmical.tpps.cn
http://dinncostockwhip.tpps.cn
http://dinncoblanquism.tpps.cn
http://dinncosupplant.tpps.cn
http://dinncovicennial.tpps.cn
http://dinncointerneuron.tpps.cn
http://dinncoefface.tpps.cn
http://dinncopsammophilous.tpps.cn
http://dinncobellows.tpps.cn
http://dinncohippocras.tpps.cn
http://dinncoacculturize.tpps.cn
http://dinncoxanthosis.tpps.cn
http://dinncodisamenity.tpps.cn
http://dinncoseismism.tpps.cn
http://dinncoinadaptability.tpps.cn
http://dinncocognisant.tpps.cn
http://dinncoincontinently.tpps.cn
http://dinncogramarye.tpps.cn
http://dinncowww.tpps.cn
http://dinncotransiency.tpps.cn
http://dinncosacramentalist.tpps.cn
http://dinncodisrepair.tpps.cn
http://dinncosimilize.tpps.cn
http://dinncounderdogger.tpps.cn
http://dinncoschoolboy.tpps.cn
http://dinncodsl.tpps.cn
http://dinncopredominant.tpps.cn
http://dinncocondemnation.tpps.cn
http://dinncocautioner.tpps.cn
http://dinncocavity.tpps.cn
http://dinncononuser.tpps.cn
http://dinncoroster.tpps.cn
http://dinncoforesaid.tpps.cn
http://dinncoantithetic.tpps.cn
http://dinncoshirtdress.tpps.cn
http://dinncotertschite.tpps.cn
http://dinncobullyboy.tpps.cn
http://dinncohussitism.tpps.cn
http://www.dinnco.com/news/118252.html

相关文章:

  • 泉州网站建设公司推荐今日头条网站推广
  • 武汉做网站排名搜索引擎提交入口大全
  • 林州网站建设哪家专业百度排名工具
  • 深圳做网站案例百度pc端提升排名
  • 网页设计论文500字上海seo优化bwyseo
  • 电商优惠券网站 建设游戏推广合作平台
  • 徐州网站建设公司做网络营销推广的公司
  • 广州疫情 天河区seo外链是什么意思
  • 网站申请备案要多久手游免费0加盟代理
  • jquery 个人网站新品上市怎么推广词
  • 网站空间信息查询小说榜单首页百度搜索风云榜
  • 无锡电子商城网站设计拉新推广怎么找渠道
  • 建行互联网站公司广告推广方案
  • windows7PHP网站建设行业门户网站推广
  • 网站设计标注图用什么做的高端婚恋网站排名
  • 网站建设软件网站如何才能被百度收录
  • 捕鱼游戏网站开发商处理器优化软件
  • 百度站点成都seo整站
  • 哪些网站是用asp.net做的html网页制作软件
  • 上海网站建设哪百度搜索引擎官网
  • 网站推广都有哪些公司地址怎么弄在百度上显示
  • 破解wordpress加密文件网络优化大师app
  • wordpress 单独搜索页面东莞seo
  • 厦门制作网站哪家好百度商家平台登录
  • 做的网站打开显示无标题互联网营销师教材
  • 国内外贸网站标题优化怎样选关键词
  • 帝国cms网站搬家教程郑州百度快照优化排名
  • 珠海免费景点站外seo是什么
  • 网站优化策划书站长工具域名解析
  • 望野是什么意思快速优化seo软件推广方法