Java Video Tutorial 32

preview_player
Показать описание

In this part of my Java Video Tutorial, I completely cover how to both write to and read character streams from files.

I explain all of the following: PrintWriter, BufferedWriter, FileWriter, BufferedReader, FileReader, common file exceptions and much more.
Рекомендации по теме
Комментарии
Автор

For anybody that is wondering, the code is in the description. In the video he missed returning the PrintWriter memory address from the method. Visit the link and see the code for better understanding Very nice video.

buttermilk_pie
Автор

I've always had issues with files in programming and I was getting discouraged when I saw persons saying the video was hard to understand but then I watched and it really opened my eyes to the use of files. Thanks so much!

danielbattick
Автор

Your videos are great, but they have one flaw. When you introduce a new concept (like writing in a file), you do it in a big program, and it is easy to get lost in that program. Sometimes I don't understand what methods are needed by the file editor and what method are part of your programm specificly.

Maybe you should begin by giving a quick overview of how the method works before writing the full programm.

TheAnat
Автор

Now this tutorial just used my brain completely. i could feel storm in my head. Found it "not easy".

simransngh
Автор

Get the code and take notes. If there is anything you have questions about send them to me and I'll do my best to help.

derekbanas
Автор

"Well, hello Internet....

...Otherwise, till next time..."

Brilliant as usual.

Folks, if you're having trouble following just pause and go back, that's the beauty of it.
Also helpful to have the full commented code (link in the description) beside you as a reference.

Pattbonn
Автор

Banas: the king of programming tutorials!

SoulSeeker
Автор

Hi again, and thanks for reply. I figured this stuff is too advanced for my "java level", so took a few days to understand basics better. I can probably try continue now, both yours and this one works :) thanks again for taking time to help :D

Mariusingame
Автор

Customer is known as an inner class. The only time were you can use a static class is in this situation. You mark it static only so you don't have to create an instance of the outer class to access this class. Main is static because it needs to be able to access many objects. That is only possible with a static function

derekbanas
Автор

Feel free to bounce around in the java tutorial. Most videos aside from those at the end are self contained. The android tutorials though are set up to watch in order because I just make one app after another

derekbanas
Автор

Thank You So much. This was really helpful. Although, you really need to watch twice and read the code to get it, ITS TOTALLY WORTH IT!

SalekeenNayeem
Автор

Anything marked as static is shared by all objects in the class. A static method can call only other static methods and can access the data in static variables. You can not call a non-static method from a static function.

derekbanas
Автор

with your method the IO stream looks like a child play in just 2 videos ... and as usual no one could do it better than you do
thank you sir ^_^

MrNAGATO
Автор

Thank you for your tutorials they are really helpful. I am reading "Java for Dummies" and I am watching your videos and it is helping heaps!

RedofYellow
Автор

You're very welcome :) Always feel free to ask questions

derekbanas
Автор

Derek, as always, thanks so much for all this effort.  I am an avid student of yours.  Given that though, let me ask a quick question...

I have been through this video multiple times, and forayed into Google along these lines as well... But for the life of me just cannot make out how I'm to conceive of the relationship between PrintWriter and FileWriter here.  You describe the former as "allowing me to write to files"... But as you can imagine, that immediately makes one wonder what "File...Writer" adds to the mix. 

I have been stuck here for days (I work on this stuff in the morning before work) and am sort of throwing up the white flag here.

Thank you!

NMOwen
Автор

+Derek Banas I love the videos; I'm a fan. Just a bit of constructive criticism:

If you made the info blurbs like ("Code available in description") pop up when you're not saying/doing anything, that would make it easier to focus on the content. I realize that viewers want to know where to get the code, and you want us to subscribe, comment, share, like, etc. and that's all well and good. But the reason we came is to UNDERSTAND something new, and if every minute or so I get distracted by a friendly little pop up, it breaks my focus on what you're saying.

I realize you probably get many comments per day, but I think this one could really help people and also get you more subscribes.

Cheers,
Nathan

Neonb
Автор

FileWriter is used to write streams of characters to a file
BufferedWriter gathers a bunch of characters and then writes them all at one time (Speeds up the Program)
PrintWriter is used to write characters to the console
I hope that helps

derekbanas
Автор

I know that. I'll have to go back to see what I was saying. I don't know I guess I didn't properly explain myself on that issue. I improv most of these videos and it is completely possible that I glossed over the topic

derekbanas
Автор

FileWriter(File file, boolean append) If the second argument is marked as true it will append rather than overwrite

derekbanas