I created an object within a class:
private class Viscosity{
float magnitude;
private Viscosity(float Magnitude){
magnitude = Magnitude;
}
}
In my main function, I attempt to extract data from a text file and create a new Viscosity object, but it seems that I cannot access this private object.
For example, I want to add it to a List of Objects:
listofObjects.add(new Viscosity(50.0f));
But I receive the error:
No enclosing instance of type is accessible. Must qualify the allocation with an enclosing instance of type ClassName (e.g. x.new A() where x is an instance of ClassName).
How can I accomplish this?