G
Guest
Gast
Code:
class Quad1
{
public static void main(String args[])
{
double A,B,C,G,x1,x2;
A=Double.parseDouble(args[0]);
B=Double.parseDouble(args[1]);
C=Double.parseDouble(args[2]);
G=B*B/(4*A*A)-(C/A);
if(G>0)
{
x1=Math.sqrt(G)-B/(2*A);
x2=Math.sqrt(G)-B/(2*A);
System.out.println(x1);
System.out.println(x2);
}
else
{
if(G==0)
{
x1=-B/(2*A);
System.out.println(x1);
}
else
System.out.println("Keine reelle Lösung!");
}
}
}
Ich bekomme diesen gemeinen Fehler beim ausführen.
>Exit code: 1
>javac Quad1.java
>Exit code: 0
>java Quad1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Quad1.main(Quad1.java:6)
>Exit code: 1
Könntet ihr so nett sein mir erklären was ich da noch falsch mache??????
Danke im voraus