mercredi 18 août 2021

How to store and print row number separated by comma in a for loop in a Java Program, I am using Java 4 [closed]

I have multiple rows on billing screen application. How do i store the row numbers for rows which have amount greater than 0 and print the row numbers separated by a comma. Eg: "Are you sure you want to proceed, The amount is > 0 for item numbers 1,4,7,8" Below is my code and I want to print row numbers in a warning prompt

for (int i = 0; i < tblClaim.getRowCount(); i++) {
    String amount = (String) claim.getValueAt(i, TableModel.FINAL_AMT);
    riAmount = Double.parseDouble(striRIAmount);
    if(riAmount>0) {
        // Do some logic to store the row numbers where the amount is > 0
    }
}
*********Waring Prompt******
Eg:     "Are you sure you want to proceed, The amount is > 0 for item numbers 1,4,7,8"

Aucun commentaire:

Enregistrer un commentaire