| Author |
constructor
|
radhika ayirala
Greenhorn
Joined: Aug 28, 2007
Posts: 24
|
|
public class test { public static void main( String [] args ) { new test(); } test() { test(2); } test(int x) { System.out.println(x); } } why is this giving an error?
|
 |
Chang Tzu-yu
Greenhorn
Joined: Sep 17, 2007
Posts: 16
|
|
Call Constructor must use "this(2)" public class test { public static void main(String[] args) { new test(); } test() { this(2); } test(int x) { System.out.println(x); } }
|
Chang Tzu-yu<br /> <br />SCJP 1.4
|
 |
radhika ayirala
Greenhorn
Joined: Aug 28, 2007
Posts: 24
|
|
|
thanks
|
 |
chandraiah chintakayalu
Ranch Hand
Joined: Aug 30, 2007
Posts: 32
|
|
when your calling a super constructor it should be called as: super(2);
|
SCJP-5 86%,SCWCD-soon
|
 |
 |
|
|
subject: constructor
|
|
|