• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question regarding println statement

 
Arjun Reddy
Ranch Hand
Posts: 629
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47228
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 629
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47228
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic