Witam,
Może problem ten pojawiał się już nie raz , w każdym razie jakoś nie mogę znalezc odpowiedzi na ten prosty przykład, a mianowicie chodzi iż cały program działa po usunięciu "= 0.0" z deklaracji.
Jakby ktoś był tak uprzejmy to proszę o pomoc :)
public class AverageFruit {
public static void main(String args[]) {
// Declare and initialize three variables
double numOranges = 50.0E-1;
double numApples = 1.0E1;
double averageFruit = 0.0;
averageFruit = (numOranges + numApples) / 2.0;
System.out.println("A totally fruity program");
System.out.println("Average fruit is " + averageFruit);
}
}
Rezultat :
An unexpected error has been detected by HotSpot Virtual Machine:
EXCEPTION_FLT_DIVIDE_BY_ZERO (0xc000008e) at pc=0x00c5a883, pid=2596, tid=2316
- Java VM: Java HotSpot(TM) Client VM (1.4.2_12-b03 mixed mode)
- Problematic frame:
- j com.sun.tools.javac.v8.comp.Items$ImmediateItem.isPosZero(D)Z+0
- An error report file with more information is saved as hs_err_pid2596.log
- If you would like to submit a bug report, please visit:
- http://java.sun.com/webapps/bugreport/crash.jsp
Errors compiling AverageFruit.