package main import ( "math" "fmt" ) //常量与枚举 //const数值可作为各种类型使用 func consts() { const fliename = "abc.txt" //常量名字不一定要全部大写 , //不定义类型又可以int 又可以float,可以不用强制类型转换 var c int c = int ( math.Sqrt( a * a + b * b)) fmt.Println( flienam…
java的枚举类型详解: 简单示例: public enum Color{ RED,BLUE,BLACK,YELLOW,GREEN } 复杂示例(带自定义构造方法与类型) public enum EnumTest { FRANK("The given name of me"), LIU("The family name of me"); private String context; private String getContext(){ return this.…