i am having trouble understanding how java's input output system works, as the sun's tutorial is helpful with swing stuff its is extramly vague with I/O.
and yes i have many books on java yet all fail to describe java's I/O effectively for the noob :P
has any one a clue on a any good books or resoures's on the internt which deal with I/O as i would like to figure it out my self with out u peopole doing my work for me because i cant get a job with other people doing my work.
im basicly coding a simple note pad application yet dont know y you need to
"throws IOException" ect
so please, if any one know of any good resources with examples i would be thankful
so yes i am obioulsly refering to Files, FileReader, FileWriter ect
NOT the obvious console I/O System.out.print
It's pretty easy stuff if you just read through the API a bit and test some stuff out. All you really need is a BufferedReader/BufferedWriter.
IOExceptions are necessary because there are many different things that can go wrong while trying to use a stream. For instance, you may try to create a FileReader with a file that does not exist, so an IOException will be thrown.
you don't need to declare your method to throw IOExceptions, you can catch them if you want. They have to be caught somewhere after all.
ok cool it makes sence that a exception has to be throwen like u stated, but as i said sun's tutorial is very vage as to how to correctly use (code) I/O and the jave api is obviously daughting for a noob such as myself.
so do u know of any good resources which teach the use of I/O with or without working examples ?????
i posted that twice,
as the sun's tutorial is helpful with swing stuff its is extramly vague with I/O.
jesus christ didnt u read my posts,
no offence but i said it not once but twice. *sigh*
First of all, I suggested reading the API at first, not the tutorials. Second, there is no need to get pissy. If you can't read an API/tutorial (oh by the way, have you heard of search engines?) enough to learn what should be a very basic concept for someone wanting to use file I/O, then maybe you need to spend more time learning the language and less time demanding exactly what you said you didn't want:
i would like to figure it out my self with out u peopole doing my work for me because i cant get a job with other people doing my work.
exactly which tutorial didn't make sense? I haven't found many that didn't help me at least a little bit.
drain this is the New to Java section
try to remember that next time.
you obviously understand java, but maby your english needs a little attention
mike: yeah i get what u mean but i just need that extra bit of background. so if you have any books or documents u can recommend for the New to Java sort of person that would be good.
thanks any way
The only java book i've ever read is Introduction to Java Programming by Liang, but I have no idea how this compares to other java books. It was just the recommended book on my course. To be honest if I ever don't know how to use something i've always used the sun API and tutorials. The API lists all the methods for a particular class and explains what they do. This is usually enough to know how to use a class, but they sometimes stick the tutorial in if its more complex.
I will now quote the API.
= new BufferedReader(new FileReader("foo.in"));
will buffer the input from the specified file. Without buffering, each invocation of read() or readLine() could cause bytes to be read from the file, converted into characters, and then returned, which can be very inefficient.
Create a buffering character-input stream that uses a default-sized input buffer.
Read a line of text.
Creates a new FileReader, given the name of the file to read from.
ill check out that book and see how i go
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center