Forums Register Login

"this" ???

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
thanks john
Attractive, successful people love this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1103 times.
Similar Threads
constructor doubt
constructor doubt
constructor doubt
HashSet Duplicate element ?
Constructors question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:03:02.