Java printf not working as expected when dividing

43 Views Asked by At

Consider the following code:

  • value of houses variable is 24
  • value of underContract variable is 19
private static void architecht(int houses, int underContract) {
    System.out.printf("\nOccupancy Rate: %,.2d ", houses/underContract);

Exception is given: java.util.IllegalFormatPrecisionException

0

There are 0 best solutions below