• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<variable> cannot be resolved to a Variable ( Java Programming Eclipse )

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Added code tags - see UseCodeTags for details]


Eclipse underlines msg in red and says "msg can not be resolved to a variable" inside method start() and graph(). There should be slightest error which i am unable to figure out. Need Help
 
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

msg is declared in the init() method. That means its scope is limited to the init() method, and you can't refer to it anywhere else. If you want to be able to refer to it in the other methods you need to declare it at the class level.

By the way, remember Java is case-sensitive and you need to be careful about case. Your Start() method won't work because it's supposed to be start().
 
Johhn Davis
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works ..... Thanks Mr. Brown
 
reply
    Bookmark Topic Watch Topic
  • New Topic