I currently have a project, where I made an error which I can't figure out why it's giving me that error.

My structure:

```
Class: Variable (commands.lib.Variable);
Class: ImageLoader extends Variable (commands.lib.Variable);

```

Then I cast a Variable to an ImageLoader:

```
// There is a variable made with: Variable v = new ImageLoader();
public static Variable(commands.lib.Variable) getVariable(String value){...}
ImageLoader t = (ImageLoader)getVariable(ab[2]);

```

But this gives me an error: 

```
Exception in thread "main" java.lang.ClassCastException: commands.lib.Variable cannot be cast to commands.variable.ImageLoader

```

So of course I googled **ClassCastException** and this post came out of the result: [Explanation of "ClassCastException" in Java](https://stackoverflow.com/questions/907360/can-someone-explain-classcastexception-in-java)

Here someone explains: 

```
Animal a = new Dog();
Dog d = (Dog) a; // no problem, the type animal can be casted to a dog, because its a dog
Cat c = (Dog) a; // raises class cast exception, you cant cast a dog to a cat

```

So for my code it will look like this:

```
Variable a = new ImageLoader();
ImageLoader b = (ImageLoader) a; // This should work, but will throw a ClassCastException
Array c = (Array) a; // This should throw a error

```

So I'm a bit clueless.
I hope someone will help me, and fix the error.

Greetings, 

Robin