File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes println() : question from JQPlus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "println() : question from JQPlus" Watch "println() : question from JQPlus" New topic
Author

println() : question from JQPlus

geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
What will happen when this code is compiled and run?

Acc.to JQPlus,the answer is the code won't compile.
I tried the above code ,it compiles and runs printing : nullnull
nulltrue
truenull

In this case,it gives a compiler error ,as it's an ambiguous reference : bcos println() can take both char[] & String as parameters.
Could someone clarify these 2 cases ?
Thanks in advance.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

1st case:
I tried to compile it, but got the following compile-time errors:

2nd case
Sorta self explanitory by the error message isn't it? if you change the code to this (and avoid the ambiguity) things compile/run fine:


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: println() : question from JQPlus
 
Similar Threads
what is "null"
srange null..!
true
Null Values..
what is the out put of this program ? why ?