G
Gast
Gast
Hallo!
Habe eine Klasse geschrieben, die Polynomials darstellen soll. Habe jetzt folgendes Prob:
bekomme ständig eine NullPointerException, hab in der Main mal ein Polynom zum testen erzeugt und wollte es ausgeben, klappt aber eben nich.
in der main
die toString Methode:
Habt ihr nen Tipp?
Habe eine Klasse geschrieben, die Polynomials darstellen soll. Habe jetzt folgendes Prob:
bekomme ständig eine NullPointerException, hab in der Main mal ein Polynom zum testen erzeugt und wollte es ausgeben, klappt aber eben nich.
in der main
Code:
Polynomial test1 = new Polynomial("15 20 -1.2 11 13.4 9 3 8 4 5 -7 3 1 0");
String output=test1.toString();
System.out.println(output) ;
die toString Methode:
Code:
public String toString ( )
{
_polyList.reset();
String polystr="";
try{
while(!_polyList.endOfList())
{
Monomial aktmon = (Monomial)_polyList.currentData();
polystr = polystr+(aktmon.getCoeff())+"x^"+(aktmon.getExp())+"+";
_polyList.advance();
}
_polyList.reset();
}catch(Exception e)}
return polystr;
}
Habt ihr nen Tipp?