Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"this" ???

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class Test6{
public Test6(){
this(4);/***********??? ****/
}
public Test6(byte var){
System.out.println(var);
}
public static void main(String[] args){
Test6 t6 = new Test6();
}
}
/**** why is 4 not passed to public Test6 constructer?
 
John Dell'Oso
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this:



The second constructor is expecting a byte. You have to use a cast as the literal 4 is assumed to be an integral type.

Regards,
JD
[ August 01, 2007: Message edited by: John Dell'Oso ]
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks john
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic