On Aug 27, 11:10 pm, JKid314159 <[email protected]> wrote:
> Dear Java Programmer:
>
>
> DataOutputStream out = new DataOutputStream(new
> FileOutputStream("invoice"));
>
> In this code, am not to clear what object the name invoice represents. I
> think I understand that a FileOutputStream object "invoice" is wrapped to a
> DataOutputStream "out?"
See the API for FileOutputStream, File, and FileDescriptor.
Basically, "invoice" here represents a File object, that is a
representation of a file on your system where eventually contents will
be written. The FileOutputStream represents a stream for sending data
over it to a given receiptor, here the File object, that is the file
invoice. And the DataOutputStream allows to send primitive data types
over an output stream.
>
> So in the second part of the program have the following code:
>
> DataInputStream in = new DataInputStream(new
> FileInputStream("invoice"));
>
> This established a FileInputStream object wrapped into a DataInputStream
> object.
Same here for read operations.
>
> The question is, how is the object in related to the object out. I don't see
> the connection.
You may see it as how does your keyboard connect with your screen,
when you type something on your keyboard and it is represented on your
screen.
Here's some notes about it (for C, but that does not change the
concepts):
http://micmacfr.homeunix.org/progsysdet/progsys05.shtml.shtml
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---