I have a few problems.

I want to read in a .dat file with characters like below:

A B C
B * D
D * J
J * *

i used a readLine() from a fileReader, and put all of the characters into a char array.

Then i want to take each character and put it on a stack, but the stack I have to build from scratch, and can only accept Objects. I have no idea how to make chars Objects, because they are inconvertible type.

Secondly I have to put all of these chars into a tree, and print out the tree in proper order. A being parent/root B left child, C right child, and then B's left child is null because of the asterisk, and B's right child is D and so on until J which has no children and its done. I have no idea how to make a tree. I want to make a class Tree, but i don't know what methods to put, I don't know what to do first, I dont know I DONT KNOOOW! and its killing me being so stuck. If anyone knows how to solve any of my problems it would help me immensly, because I'm dying slowly and painfully from this dumb program.

There is a wrapper class Character which can be used to store chars as Objects.
This is equivalent to classes like Integer, Boolean, and Double (among others).
If you're using 1.5 (Tiger, 5.0) that wrapping will be taken care of for you.

If you use the correct Tree from the collections API your sorting will be done for you and all you'll need to do is create an Iterator over the tree (which the Tree can give you) and iterate over that.

The API docs should help you find and use the classes you want.
I find it highly instructive to once in a while just sit back for an hour or so and browse through it. Despite having used Java professionally and fulltime since 1999 I still find things in there I never knew existed.

thanks for the hint on Character class...niiice....but the Tree i have to construct from scratch. can't use predifined stuff for it. I have no idea how to set up the tree class, and what methods it should have...the API has confused me more I think.

Check out any decent book on data structures, all should have information on defining trees and iterating over them.

You may also look at the sourcecode for java.util.TreeMap or java.util.TreeSet and take inspiration from there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.