Re: Is it possible to put several objects into one file?
Please do not top-post.
John wrote:
Are there delimiters in the stored file?
If you mean XML, yes. They are called "tags".
How does Java know from where to where an objec is in the file?
I suggest that you read the documentation for JAXB and for Java serialization.
I do not know the details of how Java serialization works in "the stored
file", because I've never needed to know.
If you are looking to implement a file storage based on storing entire objects
it might get very complicated. You could just store the questions and the
answers as text, since they are strings to begin with. So instead of
serialization, which is difficult, you have reading and writing Strings, which
is easy.
When JAXB will let you translate objects to an XML text representation, what
part of the object is translated?
As much as you want, but it takes some thought to plan it properly. You may
need to learn XML Schema to use it right.
For an object of True/Flase question class, is just the question translated?
what does the JAXB do with the method?
It does only what you tell it to do.
It's a sort of complicated way to do what a PrintWriter println() and
BufferedReader readLine() will probably be able to do for you just fine.
You also might consider doing clever things with properties files. They are
set up as key=value pairs. You could interpret that as question=answer and
take advantage of what Java can do with Properties objects.
The Javadocs will help you with such standard things as I/O and Properties.
--
Lew