Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

java casting problem


shadow31's Avatar
Member
0 0

so I have a class called "test", In another class i have created an arraylist<objects> list but it wont let me cast the test object into the arraylist. It is giving me a null.pointer.exception

so I use list.add(new test());

What am I missing or what am i doing wrong


fuser's Avatar
Member
0 -1

well, as much as I'd like to hone my psychic powers in figuring out your problem with a basic description, it appears my powers are sadly limited, so you'll have to post the code so that I can see the problem.


shadow31's Avatar
Member
0 0

i would but we got the problem solved. The arraylist wasn't initialized correctly