aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wht would be out  put of the programm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wht would be out  put of the programm" Watch "wht would be out  put of the programm" New topic
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: 193
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: wht would be out put of the programm