How to write narray Tree? example pls

S

sanny.h

Hi all,
Thank you all for having this group.
I am new to the world of java.
I want to write a java program were the strings are stored in a
tree (not binary tree).
For example
1) "APPLE" -> "RED"
2) "APPLE" -> "WHITE"
3) "APPLE" -> "USA" ->"RED"
4)"APPLE" -> "USA" -> "WHITE"
5) "APPLE" -> "USA" -> "NYC" -> "RED" ............soon

So APPLE will have 3 child nodes (RED,WHITE,USA). Child node USA will
have 3 child nodes (RED,WHITE,NYC) , NYC has RED ......soon.

If not tree any other method that i can achieve this?

Thanks in advance.
sanny.
 
A

Andrey Kuznetsov

Thank you all for having this group.
I am new to the world of java.
I want to write a java program were the strings are stored in a
tree (not binary tree).
For example
1) "APPLE" -> "RED"
2) "APPLE" -> "WHITE"
3) "APPLE" -> "USA" ->"RED"
4)"APPLE" -> "USA" -> "WHITE"
5) "APPLE" -> "USA" -> "NYC" -> "RED" ............soon

So APPLE will have 3 child nodes (RED,WHITE,USA). Child node USA will
have 3 child nodes (RED,WHITE,NYC) , NYC has RED ......soon.

If not tree any other method that i can achieve this?

see TreeModel, DefaultTreeModel and JTree
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top