I am new to Java and have been working through a book a buddy of mine is letting me borrow. However, I believe the book may be a bit out of date.
I am trying to print a price, and to do so the book uses the example (packPrice & packVolume are both double variables entered using in.nextDouble()):
double pricePerOunce = packPrice / packVolume;
System.out.printf("Price per ounce: %8.2f", pricePerOunce);
System.out.println();
However, when I try the exact same code in Java SE 8u5 (Windows 64 bit), I get the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method printf(String, Object[]) in the type PrintStream is not applicable for
the arguments (String, double)
Does anyone have the remedy to my problem? Let me know if any more information is needed.
Thanks in advance!