The short answer is yes. I haven't checked to see if that specific code works, but once you've created an object it makes no difference where it came from when you're adding it to an ArrayList. If you can get a reference to a Student1 object, you can add it

The best approach, though, when you're faced with a question "can I do this" is to try it out. Write a small program to test it - it's the most effective way to learn. Then, once you know what does happen, you can ask questions about why it happens.

(By the way, you can edit an existing message to fix formatting - you don't need to post another one).

Anne Saizan

Ranch Hand

Posts: 35

posted 6 years ago

oky thank you so much..=)
sorry about the code...
i am still new here..=)
bdw thanks..
nice java forum..