zoukankan      html  css  js  c++  java
  • Document

    /****
    * 带有构造方法的枚举
    * @author yanlong
    * 2017/5/7
    */
    package local;

    public class EnumTest {
    public static void main(String[] args){

    WeekDay weekDay2=WeekDay.FRI;
    System.out.println(weekDay2.name());
    System.out.println(weekDay2.ordinal());
    }
    public enum WeekDay{
    SUN(1),MON,TUS(3),WEN,THI,FRI,SAT;
    private WeekDay(){System.out.println("first");}
    private WeekDay(int day){System.out.println("second");}
    }
    }

    ————————————————————————————————————————————————————————

    /****
    * 带有构造方法的枚举
    * @author yanlong
    * 2017/5/7
    */
    package local;

    import java.sql.Date;

    public class EnumTest {
    public static void main(String[] args){

    WeekDay weekDay2=WeekDay.FRI;
    System.out.println(weekDay2.name());
    System.out.println(weekDay2.ordinal());

    new Date(300);
    }
    public enum WeekDay{
    SUN(1),MON,TUS(3),WEN,THI,FRI,SAT;
    private WeekDay(){System.out.println("first");}
    private WeekDay(int day){System.out.println("second");

    }
    }
    public enum TrafficLamp{
    RED(30){
    public TrafficLamp nextLamp(){
    return GREEN;
    }

    },
    GREEN(45){
    public TrafficLamp nextLamp(){
    return YELLOW;
    }
    },
    YELLOW(5){
    public TrafficLamp nextLamp(){
    return RED;
    }
    };
    private int time;
    public abstract TrafficLamp nextLamp();
    private TrafficLamp(int time){
    this.time=time;
    }
    }
    }

  • 相关阅读:
    关于软工文档规范性——国标文档
    关于游戏平衡性——王者荣耀野怪数值参考
    单元测试特性标签(结合代码)
    常用标签梳理
    图片文件的转换、加载及缩放显示
    认识ManualResetEvent
    HTML简介
    HTML基本结构
    15年,我在深圳
    为什么坚持,想一想当初
  • 原文地址:https://www.cnblogs.com/chenyanlong/p/6820236.html
Copyright © 2011-2022 走看看