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

北京定制网站开发公司深圳做网站的好公司

北京定制网站开发公司,深圳做网站的好公司,网页设计与网站建设中的热点,音乐网站建立public classTestEnum {/*最普通的枚举*/public enumColorSelect {red, green, yellow, blue;}/*枚举也可以象一般的类一样添加方法和属性,你可以为它添加静态和非静态的属性或方法,这一切都象你在一般的类中做的那样.*/public enumSeason {//枚举列表必须写在最前面#xff0…public classTestEnum {/*最普通的枚举*/public enumColorSelect {red, green, yellow, blue;}/*枚举也可以象一般的类一样添加方法和属性,你可以为它添加静态和非静态的属性或方法,这一切都象你在一般的类中做的那样.*/public enumSeason {//枚举列表必须写在最前面否则编译出错winter, spring, summer, fall;private final static String location Phoenix;public staticSeason getBest() {if (location.equals(Phoenix))returnwinter;elsereturnsummer;}}/*还可以有构造方法*/public enumTemp {/*通过括号赋值,而且必须有带参构造器和一属性跟方法否则编译出错* 赋值必须是都赋值或都不赋值不能一部分赋值一部分不赋值* 如果不赋值则不能写构造器赋值编译也出错*/absoluteZero(-459), freezing(32),boiling(212), paperBurns(451);private final intvalue;public intgetValue() {returnvalue;}//构造器默认也只能是private, 从而保证构造函数只能在内部使用Temp(intvalue) {this.value value;}}public static voidmain(String[] args) {/** 枚举类型是一种类型用于定义变量以限制变量的赋值 赋值时通过枚举名.值来取得相关枚举中的值*/ColorSelect mColorSelect.blue;switch(m) {/*注意:枚举重写了ToString(),说以枚举变量的值是不带前缀的*所以为blue而非ColorSelect.blue*/casered:System.out.println(color is red);break;casegreen:System.out.println(color is green);break;caseyellow:System.out.println(color is yellow);break;caseblue:System.out.println(color is blue);break;}System.out.println(遍历ColorSelect中的值);/*通过values()获得枚举值的数组*/for(ColorSelect c : ColorSelect.values()) {System.out.println(c);}System.out.println(枚举ColorSelect中的值有ColorSelect.values().length个);/*ordinal()返回枚举值在枚举中的索引位置从0开始*/System.out.println(ColorSelect.red.ordinal());//0System.out.println(ColorSelect.green.ordinal());//1System.out.println(ColorSelect.yellow.ordinal());//2System.out.println(ColorSelect.blue.ordinal());//3/*枚举默认实现了java.lang.Comparable接口*/System.out.println(ColorSelect.red.compareTo(ColorSelect.green));System.out.println(Season.getBest());for(Temp t:Temp.values()){/*通过getValue()取得相关枚举的值*/System.out.println(t的值是t.getValue());}}}
http://www.pierceye.com/news/504518/

相关文章:

  • 网站域名有了_网站如何建设优书网首页
  • 宠物网站建设策划报告Wordpress is文章展示
  • 电子建设网站的目的阿里巴巴网站是用什么技术做的
  • 图形设计网站wordpress微信群多个二维码
  • 网站建设维护是干什么网站用户需求报告
  • 咸宁网站建设公司水网站模板
  • 移动网站开发教材seo网站排名优化价格
  • 重生做网站小说畅想网络网站建设推广
  • 找个做网站的 优帮云wordpress 判断自定义栏目
  • wordpress文章目录分页wordpress加速优化服务
  • 二级目录网站怎么做小程序开发成都公司
  • 网站标题名字和备案名字网站开发 质量管理
  • 网站与系统开发吉安网站建设收费
  • 湖北襄阳网站建设wordpress电商ar
  • 微做网站环保行业网站建设
  • 昭通做网站公司北京手机网站制作多少钱
  • 昆明企业建网站多少钱如何弄微信小程序
  • wordpress清理网站缓存做的比较简约的网站
  • 青岛高端网站制作中铁建设集团门户密码
  • 公司专业做网站做网站域名起什么作用
  • 推广型网站建设机构如何创建wordpress
  • 做网站交互demo工具在线设计自己的签名免费
  • 做百度推广会送网站吗网站建设和邮箱的关联
  • 假网站如何做济南天桥区网站建设
  • 顺企网我做网站余姚网站建设在哪里
  • 做网站logo用啥软件做电子书网站
  • 企业网站推广的策略有哪些php怎么建立站点
  • 找网站设计公司 看那些wordpress居中
  • 无锡网站营销公司哪家好全屏网页设计尺寸
  • 做第一个网站什么类型网站搜索引擎优化案例