The Little Guy Posted October 26, 2012 Share Posted October 26, 2012 (edited) I am fairly new to Java. So, my question is: public myClass{ public Object avgRGB(int img){ // Some unrelated code to the problem Object avg = new Object(){ public double red = 0.0; public double green = 0.0; public double blue = 0.0; public double bw = 0.0; }; avg.bw = ((red / count) + (green / count) + (blue / count)) / 3; } } With, "avg.bw = ..." my Netbeans editor is giving me an error: "can not find variable bw" Why not? Edited October 26, 2012 by The Little Guy Quote Link to comment Share on other sites More sharing options...
requinix Posted October 26, 2012 Share Posted October 26, 2012 (edited) Does it compile? The syntax looks right. Maybe Netbeans just doesn't like completing anonymous objects. Edited October 26, 2012 by requinix Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.