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 Beginning Java and the fly likes Question regarding println statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question regarding println statement" Watch "Question regarding println statement" New topic
Author

Question regarding println statement

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
Hi all,

Why does the first println statement in the following code works and the other does not? Is it because in the first println statement, 12 is actually converted to a string? and in the second println statament, bye is considered as some variable that has not been initialized something? please explain.



Thanks.


Be Humble... Be Nice.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43935
    
  33
Yes, because you haven't declared or initialised "bye." Actually the 2nd println statement won't compile, it would work if bye existed.
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43935
    
  33
You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question regarding println statement
 
jQuery in Action, 3rd edition