Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

color help

 
AjayG Shah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks,
Below is a code I have been writing on my own (well a modification from what online version read). The error has been highlighted.



The error message reads: "green cannot be resolved to a variable". I really have no clue what this means. If somebody can help me 1)understand what this message actually means for future reference and 2) how to resolve the issue, I will really appreciate it.
Thanks a lot!!!
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ajay,

Try to do some googling its quiet easy question and also plese use the code tag here.Dont post code without any code tags.

Here , you have taken the color type as string so you need to put the green in quotes which will solve the problem.

Regards
Jatan

 
AjayG Shah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jatan,
Thank you for your reply!
1) What is code tag?
2) When are quotes NOT required? :S

Thank you! I apologize for not aligning my message as per the rules. Just a newbie here!!
 
Campbell Ritchie
Sheriff
Pie
Posts: 49756
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you write green, the compiler thinks you want the variable of that name. If you write "green", that means a String with the contents green.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49756
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added code tags, but that highlighted the iffy indentation. Have a look at some suggestions about indentation here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic