1

Can Someone help me? I keep getting this error but don't know what to do. Thanks!!!

FrogsJSpinner.addChangeListener( new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent ce) {
           throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        Number.totalFrogPrice = Double.parseDouble(ce.getSource().toString());
        }
    });
Jinyu Wu
  • 85
  • 1
  • 11
  • How do you expect lines after an exception is thrown to execute? – Andrew Li Oct 08 '16 at 03:50
  • oh! The error is unreachable statement. – Jinyu Wu Oct 08 '16 at 04:02
  • oh! I got it, but why do they want to throw that exception? – Jinyu Wu Oct 08 '16 at 04:07
  • Looks like the reason is because the operation isn't supported, hence the name `UnsupportedOperationException`. Probably something work in progress or under development and not implemented yet. – Andrew Li Oct 08 '16 at 04:08
  • I delete throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. and is good to go – Jinyu Wu Oct 08 '16 at 04:09
  • Because it won't throw and exception, thus it won't stop execution allowing the statement to be reachable :) – Andrew Li Oct 08 '16 at 04:10
  • if there are three different JSpinner, how can I use switch statement to catch the right one if JSpinner doesn't even have a ID? Because I don't wanna create three anonymous class. – Jinyu Wu Oct 08 '16 at 04:15
  • 2
    I suspect that you're supposed to replace that with whatever implementation you need to provide. – Joe C Oct 08 '16 at 06:20

0 Answers0