Hi, g.setColor(Color.red.yellow.green.red.cyan);//1 g.drawLine(0,0,100,100); where g-graphicscontext o/p--line with cyan color. Why doesnt it give error in the argument of setColor??
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Becase Color.red return a Color object.
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Because the member variables yellow,black, red etc of class "Color" are themselves instances of class "Color" The following code compiles and prints 10. <CODE> ------------------------------------------------- class Test1 { public static final Test1 testIns1=new Test1(); public static final Test1 testIns2=new Test1(); public static final Test1 testIns3=new Test1(); int i=10; } public class Test { public static void main(String[] args) { Test1 t = new Test1(); System.out.println(t.testIns1.testIns2.testIns3.i); } } ----------------------------------------------------- </CODE>