| Author |
this(Color.Red) ?
|
K Srinivasan
Ranch Hand
Joined: Mar 08, 2010
Posts: 34
|
|
Hi,
Can someone explain me this code from HFJ , chapter on constructors.
what does 'this (Color. Red) ;' do ?
specifically what is Color.Red ??
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
Color.red and Color.RED are static final fields of class java.awt.Color. Apparently this Color.Red is something similar.
As for "this(...)", it calls another constructor.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
eric totte
Greenhorn
Joined: Aug 13, 2010
Posts: 10
|
|
|
By default, the car is red. The default constructor calls the overloaded constructor.
|
 |
K Srinivasan
Ranch Hand
Joined: Mar 08, 2010
Posts: 34
|
|
thanks :)
is
calling
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
|
It is indeed.
|
 |
 |
|
|
subject: this(Color.Red) ?
|
|
|