ALso please note that i am looking for dynamic array .
Thanks
> Hi,
> when i try to call the following class function "set_world(String w)"
[quoted text clipped - 32 lines]
>
> }
> Hi,
> when i try to call the following class function "set_world(String w)"
[quoted text clipped - 31 lines]
>
> }
First of all, try to follow the naming conventions in your code:
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
The problem you're having, is that you're trying to use an array of Strings
that is not instantiated (so it is still null).
So change the line
private String[] worlds;
to
private String[] worlds = new String[SIZE_YOU_NEED];
You also do something very bad when catching the Exception. Instead of
seeing the actual error, you now only see your own message. At the very
least, do something like ee.printStacktrace(), which would have shown the
specific error you were having (NullPointerException), and on what line it
was.

Signature
Kind regards,
Christophe Vanfleteren
ssaa - 03 Apr 2004 10:10 GMT
Thanks alot for the hint, But As you said i need to use
private String[] worlds = new String[SIZE_YOU_NEED];
i was wondering, is there any way to create a dynamic array because my
array size can vary. what is your suggestion for using Vector for
storing string ?
Thanks once again.
=***********************************************
>>Hi,
>>when i try to call the following class function "set_world(String w)"
[quoted text clipped - 48 lines]
> specific error you were having (NullPointerException), and on what line it
> was.
Christophe Vanfleteren - 03 Apr 2004 10:33 GMT
> Thanks alot for the hint, But As you said i need to use
>
[quoted text clipped - 3 lines]
> array size can vary. what is your suggestion for using Vector for
> storing string ?
Please don't toppost.
One of the classes of the Collections framework will do:
http://java.sun.com/docs/books/tutorial/collections/
An implementation of the List interface (like ArrayList) resembles a
resizable array the most.

Signature
Kind regards,
Christophe Vanfleteren