aspose file tools*
The moose likes Beginning Java and the fly likes this(Color.Red) ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "this(Color.Red) ? " Watch "this(Color.Red) ? " New topic
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: 19760
    
  20

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 - OCEEJBD 6
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: 19760
    
  20

It is indeed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: this(Color.Red) ?