0

I just started java programming on BlueJ at University and some of the hard parts are done for us so we can do the easier bits.The project is to create a bar chart with a label. So on the test bit there is this block of code and it has an error which I don't know how to fix, The error is "bar.getLabel()" and BlueJ states "cannot find symbol - method getLabel()".

Bar bar = new Bar("My Bar", 50);
assertEquals(bar.getLabel().getText(), "My Bar");
assertEquals(bar.getValue(), 0);
assertEquals(bar.getView().getWidth(), 0);
assertEquals(bar.getView().getHeight(), 50);
KB_Shayan
  • 632
  • 8
  • 24
  • 2
    "it has an error" - always, *always* say what the error is. Also, please provide a [mcve] rather than just a snippet, and please format your post so the code is easily readable. – Jon Skeet Oct 12 '16 at 20:49
  • 1
    Your error is telling you that the Bar class does not have a public `getLabel()` method, at least not one without a parameter. Better check Bar's code. If Bar is **your** class, then perhaps you will want to give it this method. – Hovercraft Full Of Eels Oct 12 '16 at 20:56
  • Please see the [link to a duplicate question used to close this question](http://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-compilation-error-mean) for more on this. Also more similar questions can be found via [this Google search](https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=site:stackoverflow.com+java+cannot+find+symbol) -- the lesson being "search on your error message if it confuses you". – Hovercraft Full Of Eels Oct 12 '16 at 20:58

0 Answers0