Can somebody explain why the code below compiles. Why does Main a = new Main(3) call the constructor that takes the float argument. How does JAVA handle implicit promotion for constructor arguments? Thanks!
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
Andreas In your constructor Main(float i) you pass the float value for i in but you never assign it to anything. The this() call your constructor with no arguments which is always going to assign the value 3 to i.
subject: Implicit promotion for constructor arguments