Class parsing is a pain in my buttocks

Class location;

public void setLocation(Class place)
{
location = place;
}

‘location.toString()’ gives me “class world.World” instead of the contents of the toString method in my World class.

Why?

EDIT: FIXED
Solution: convert everything to an object instead of type ‘Class’.

What world class? can you post more of your code?

…you do know that all objects inherit toString() from Object, right?

Looks like you believe World extends Class. However, it extends java.lang.Object.
I agree the naming of the classes in the Java API is sometimes misleading.

Sorry fellas.
I ended up seeing my errors after a bit.

In the end it turned out that I didn’t override toString() properly.

[quote]‘location.toString()’ gives me “class world.World”
[/quote]
The default behavior of the ‘toString()’ method is return a string like ‘world.World@e38b2a’ where the number (in hex) is the memory address of the object.

In your case the string returned is the call to java.lang.Class’ toString() method.

Your world class code may be:

class World extends Class{
...
}

but it should be just:

class World{
...
}

until you want to inherit something from the class ‘Class’.

Remember that in Java all clases extends from Object (by default, you don’t need to explicitly put the ‘extends Object’ statement.

Rafael.