I have a class called CollsionForm
that is an XML class definition.
When I try to intialize a variable:
CollisionForm collision;
and reference it later in the method like this:
return collision;
I get an error that it may not be initialized first.
How do I initialize the variable collisionform
like I would if I did: String str = new String.empty
?
I tried CollisionForm collision = new CollisionForm;
But that gives the error:
Cannot Access Internal Constructor 'CollisionForm' here.
Just set it equal to null:
CollisionForm collision = null;
Make sure the returning code accepts null
as a valid return value of course. The compiler just wants to make sure some value is assigned to the variable before using it.