File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "println() : question from JQPlus" Watch "println() : question from JQPlus" New topic

println() : question from JQPlus

geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
What will happen when this code is compiled and run? JQPlus,the answer is the code won't compile.
I tried the above code ,it compiles and runs printing : nullnull

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

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:
subject: println() : question from JQPlus
It's not a secret anymore!