Well, you know why null pointer errors exist?
BECAUSE THEY FEEL SO DAMN GOOD ONCE FOUND!
Glad we could help.
Type: Posts; User: JonLane
Well, you know why null pointer errors exist?
BECAUSE THEY FEEL SO DAMN GOOD ONCE FOUND!
Glad we could help.
see two posts above
add this to your toString statement,
The reason you were not getting the first (highest) node is because you skipped doing anything with head.
if(head != null)
{
output += "(" +head.Element1...
I played with your new poly method, and it never seems to print the first/ highest poly, but they seem to order correctly
I would look in your print (toString?) for this slight oversight.
The...
just because an error occurs when trying to add, doesn't mean add is the problem.
rather then "look" through code you have to "trace" through it.
Elaboration:
these are the exception paths....
Norm the run-time data is as follows:
-12
5
Exception in thread "main" java.lang.NullPointerException
at Polynomial.add(Polynomial.java:46)
at...
With out getting to deep in your code, rather then remove "buggy" code.
It is better to replace it with dummy code.
public Polynomial prep(String s)
{
// return //not to sure, but you...