GeeCON Prague 2014*
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: 627
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: 39084
    
  23
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: 627
Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39084
    
  23
You're welcome.
 
GeeCON Prague 2014
 
subject: Question regarding println statement