| Author |
wht would be out put of the programm
|
Akhilesh Yadav
Ranch Hand
Joined: Apr 04, 2006
Posts: 46
|
|
public class C { public static void main(String [] args){ new C(); } public C(int x){ System.out.println( " " + (x*2)); } public C(long x) { System.out.println("" +x); } public void C(){ System.out.println("no"); } }
|
 |
Arno Reper
Ranch Hand
Joined: Mar 14, 2006
Posts: 286
|
|
hi, the output ll be...compiler error no C() constructor found ( or something like that) arno
|
The man who makes no mistakes does not usually make anything<br /> <br />>>> SCJP 5.0 >> SCJD B&S <<< In progress
|
 |
Arno Reper
Ranch Hand
Joined: Mar 14, 2006
Posts: 286
|
|
ps : public void C() isn't a constructor...its just a bad idea to use a method with the same name as the class/constructor... arno
|
 |
Chandrasekhar Mangipudi
Ranch Hand
Joined: Jan 29, 2006
Posts: 118
|
|
Compiletime Error occurs in the program. Because user defined Empty constructor must be defined in the program to avoid compile time error.
|
Thanks & Regards,
ChandraSekharMangipudi
|
 |
Joshua Smith
Ranch Hand
Joined: Aug 22, 2005
Posts: 192
|
|
If you remove the void keyword from the snippet below... ...then you'll have a no-args constructor and it will compile. Josh
|
Rational Pi Blog - Java, SCJP, Dev Bits- http://rationalpi.wordpress.com
|
 |
 |
|
|
subject: wht would be out put of the programm
|
|
|