This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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
Have you checked out Aspose?
subject: println() : question from JQPlus
jQuery in Action, 3rd edition