aspose file tools
The moose likes Beginning Java and the fly likes Question regarding println statement Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 624
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: 32833
    
    4
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: 624
Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
You're welcome.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Question regarding println statement
 
Similar Threads
switch() flow of execution
Exception
CHAR
gc of String literals
array?