Trying to instantiate objects within for loop and failing

后端 未结 4 555
暗喜
暗喜 2021-01-29 08:40

Basically I am trying to create a new class as long as the continue variable equals \"Y\". The problem I am having is

DigitalMain.java:18: not a statement
    D         


        
4条回答
  •  暖寄归人
    2021-01-29 09:08

    What kind of loop you are using.

    for(...)
    {
    ...
    }while();
    

    There is no for-while loop.

    And also your for loop condition never going to become false. Set a proper condition to your for loop.
    Also there is syntax error in your for-while loop. ie. last statement

    continueQuestion = JOptionPane.showInputDialog('Height: ' + class[i].getHeight + '\n\lWidth: ' + class[i].getWidth + '\n\l Resolution: ' + class[i].getResolution + '\n\lCompression Ratio: ' + class[i].getCompression + '\n\lRequired Storage: ' + class[i].calcStorage() + '\n\lPrice of Scanned Photo: ' + class[i].getCost() + 'Please enter "Y" to try again or anything but "Y" to accept values.') // you miss the ;     
    

提交回复
热议问题