Hey,
iv been working on a fairly simple part of my program but it throws a null pointer exception. The error i recieve is :
Exception in thread "main" java.lang.NullPointerException
at FillStyle.<init>(FillStyle.java:12)
at compiler.main(Builder.java:43
The code causing the error is :
public FillStyle(int type)
{
if (type >= 0) {
UI8 g = new UI8(type);
toutput = toutput.concat(g.ToUI8()); //Line 12
//output is a string that adds a string another string from class UI8
}
}
The method is being called in main like this :
StyleArray ff = new StyleArray(new FillStyle(0));
Reasonably simple, and there is no syntax errors, but it seems to be that UI8 seems to be garbage collected or not being called correctly within the If condition causing it to be null pointer? The class UI8 just converts the int to a string, and the getOutput just retrieves the string.