• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

this(Color.Red) ?

 
K Srinivasan
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
eric totte
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default, the car is red. The default constructor calls the overloaded constructor.
 
K Srinivasan
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks :)
is


calling
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is indeed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic