Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Variable Scope and Life time  RSS feed

 
Tharindu Priyath
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This program is correct.


But this program is compile error.Why
 
Campbell Ritchie
Marshal
Posts: 55705
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please look at a few threads in our “beginning Java” forum: 1 2 3 4.

Are there several people all in the same class who are struggling with this question? All those threads appear to be about the same question as you are asking here. They will also probably answer your question.
 
Campbell Ritchie
Marshal
Posts: 55705
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added code tags to your post, and you can see how much better it looks Please always use those tags.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!