考题
设有说明var color:(red,green,yellow,blue);a:boolean;下面语句正确的是( )。
Aolor:=‘green‘;Bwriteln(green);Cwriteln(color);Da:=color=red;
考题
publicclassBall{publicenumColor{RED,GREEN,BLUE};publicvoidfoo(){//insertcodehere{System.out.println(c);}}}Whichcodeinsertedatline14causesthefoomethodtoprintRED,GREEN,andBLUE?()
A.for(Colorc:Color.values())B.for(Colorc=RED;c=BLUE;c++)C.for(Colorc;c.hasNext();c.next())D.for(Colorc=Color[0];c=Color[2];c++)E.for(Colorc=Color.RED;c=Color.BLUE;c++)
考题
对于这样的一个枚举类型:enum Color:byte{Red,Green,Blue,Orange}
考题
阅读以下说明和 Java 代码,填补代码中的空缺,将解答填入答题纸的对应栏内。 【说明】 设计 RGB 方式表示颜色的调色板,进行绘图。其类图如图 6-1 所示。该程序的 Java代码附后。图6-1 类图【Java 代码】 //颜色类 class MyColor { private int red ,green, blue; public MyColor( ) { red = o; green = 0; blue = 0; } public MyColor(int red ,int green ,int blue) { this.red = red; this.green = green; this.blue = blue; } //其他方法略 public String toString( ) { return Red: + red + \tGreen: + green + \tBlue + blue; } } //调色板类 class Palette { public int number; / /颜色数 private (1)palette; //颜色表 public Palette( ) { number = 256; palette = new MyColor[number); } public Palette(MyColor[] palette ,int number) { (2)= number; (3)= palette; } //其他方法略 public String toString( ) { String str = ; for (int i = 0; i number; i++) { str +=i+ : + palette[i] + \n; } return str; } //绘图类 class Drawing { public (4) int COLORNUMBER = 16; public static void main(String[] args) { Palette palette; int red ,green ,blue; MyColor[] color = new MyColor[COLORNUMBER]; for (int i = 0; i COLORNUMBER; i++) { red = (int) (Math.random( ) * 256); green = (int) (Math.random( ) * 256); blue = (int) (Math.random( ) * 256); color [i] = (5) (red ,green ,blue); } palette = new Palette(color ,COLORNUMBER); System.out.println(palette); } }
考题
1、如下选项,哪个不是定义类型名tcolor________。A.enum tcolor{red, green, blue};B.typedef enum color{red,green,blue} tcolor;C.enum color {red,green,blue}; typedef enum color tcolor;D.typedef enum {red,green,blue} tcolor;
考题
定义一个颜色的枚举类型Color,下面正确的是()。A.public enum Color {red, green, yellow, blue}B.public enum Color {1:red, 2:green, 3:yellow, 4:blue}C.public enum Color {1:red; 2:green; 3:yellow; 4:blue}D.public enum Color {Stringred, String green, String yellow, String blue}
考题
如下选项,哪个不是定义类型名tcolor________。A.enum tcolor{red, green, blue};B.typedef enum color{red,green,blue} tcolor;C.enum color {red,green,blue}; typedef enum color tcolor;D.typedef enum {red,green,blue} tcolor;
考题
在Android中颜色值的排列顺序是A.Red-Green-Blue-AlphaB.Alpha-Red-Blue-GreenC.Alpha-Red-Green-BlueD.Blue-Green-Red-Alpha
考题
8、定义一个颜色的枚举类型Color,下面正确的是()。A.public enum Color {red, green, yellow, blue}B.public enum Color {1:red, 2:green, 3:yellow, 4:blue}C.public enum Color {1:red; 2:green; 3:yellow; 4:blue}D.public enum Color {Stringred, String green, String yellow, String blue}