This is the first time i feel like i'm understanding everything in a coding tutorial. Your steps are so clear and you don't skip anything. You don't make anything complicated and show it as simple as it is. Perfect video. Thank you so much John, i hope you have a nice day!
For anyone that does not know, you can use "try with resources" instead of closing the buffered items (and everything that implements closeable interface)
I've worked in this industry for years but as a lower level tech employee and am needing to brush up again. These tutorials are just fantastic. If you can understand why you'd do things this really clears up the rest. To boot, they are really concise and nicely made. Thanks man I do appreciate it.
Perfect video. I can't begin to explain to you the confusion college classes give when explaining this type of stuff. Its great to have you as a resource for learning what they lack to teach properly. Much thanks, John.
Yeah.. as someone pointed out.. try-with-resources is a good way to show best practice for any resource that implements closeable .. something like this try (BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt"))) { writer.write("Writing to a file"); } catch (Exception e) { e.printStackTrace(); }
Each time I am struggling with a notion on CodeGym I am on the lookout for one of your videos. And each time it gets crystal clear when you explain it. Thank you so much for your work !
You're an absolute god-send. I've been struggling with these last couple weeks of the semester, but you're able to explain these concepts so easily with clear examples to help walk us through them. You're great!
We were given an assignment to code all kinds of shapes, and the lecturer deliberately did not teach how to save files. And I asked him why they don't teach, but they did put it in the assignment, he said he wants us to learn to code and think twice about how everything works, only after watching your video, I understood the meaning of why he wanted it, there won't always be someone next to you to tell you, this is the stage you need study alone and look for answers
This is the easiest way to understand the I/O. The university teacher and other youtubers make this a tedious topic, but you made it so much easier. Thanks a lot!
As a JS engineer after starting to learn JAVA I've been wondering why every JAVA tutorial is recoreded in 320p quality with shitty audio !!!! finally a java tutorial with JS tutorials standards lol thank you so much.
Hey John, regarding the 'while' loop, I'd rather simply implement it using '.ready()' i.e.: while (reader.ready()) System.out.println(reader.readLine()); Which does exactly the same thing as your code. Thank you for the great content and best regards !
That is an old and complicated way. The easiest way is to just put your lines in a list and call : Files.write("path","your list") ; That's all. You also need to handle the ioException though. Reading is simple too: List lines = Files.read("path").collect(Collectors.toList());
@@francis.joseph I'm not sure but a raw loop with a filewriter is probably faster. But the point in this method is simplicity and reliability. Also 9/10 such performance differences are not important. If you write to a file many times a second you should think about refactoring the code and buffer the data.
Man, I keep finding great video lessons like this that do a better job of explaining and teaching than my own PROFESSORS do. It is fucked up how expensive College is for what we get out of it aside from "certification", essentially, and a way to officially show we have taken the courses.
You should close the resources in finally block or use a try with resources to guarantee the resources are closed. If you don't do this and there is some exception while running the writes, the resource will never be closed.
lol, shameless plug of your course at beginning.... I hear less than 3 min of you speak and now I'm looking at that course like it's a nicely made steak dinner! Fantastic content! Both java knowledge and ability to teach!!!
This would be a good place to use Java’s try-with-resources statement which automatically close the file when leaving a code block. For a small program like this, main() can also be declared as “void main(String[] args) throws IOException” which would end the program and print a stack trace in case of error.
Pls upload more vdos as i cant afford to spend more online .... You are my only hope towards fun learning...pls make every type vdo related coding ... i will watch and learn them all..
Your way of explaining is very good. You kinda like go through the way of thinking, your explanation is in a very logical order. I'm very impressed, very good 👍🏻
if you create a PrintWriter instead of BufferedReader it comes with the normal print statements (print, println, printf) which is much easier and more familiar
Ok, this videos was awesome. Currently taking Udemy’s “Java Programming Master Class” it’s very in-depth…and I’m always looking for Channels/videos like your to fill in the gaps and give a different/simpler explanation on what seems to be complex topics. You should offer private lessons in addition to your Course. IMHO. 🙌🏿🙌🏿🙌🏿
@@CodingWithJohn I think it would be a very complimentary “course” for that course if nothing else. Just A Thought…. P.S. I will be visiting your other vids to reinforce and fill in the gaps in other topics/areas in Java. e.g “LinkedList” ans pointers lmao..
It's good to have a "go to" set of objects/methods for this kind of work. I like the BufferedReader/Writer approach and if I'm not mistaken it will even scale up and allow an efficient job with larger data.
Always used scanner for this sort of things, and when I first time saw this monstrosity of a code at algorythmic test, I was terrified. Thanks to your tutorial now I uderstand it is preatty useful and easy to use. Thanks a lot and keep up the good work.
At 2:30, actually the set is written on the fly even without the close() method being called. Edit: My bad, I used a Try With Resources, that's why I didn't need to call close() which is called automatically with TWR.
Thank you for creating such informative and helpful content. Your explanation of Java File Input/Output made a difference in understanding this complex concept. P.S. wrote/read the above comments from this lesson FileIO in Eclipse! Thanks
If someone doesn't wanna deal with a try-catch block everytime you wanna create or read a file, simple declare your main function like this: public static void main(String args[]) throws IOException { ... //Your code goes here }
but what if the text made of a lot of paragraphs and it needs an empty line whenever has a new paragraph, will the read code still works? anyway, great video, thanks sir John!
This is the first time i feel like i'm understanding everything in a coding tutorial. Your steps are so clear and you don't skip anything. You don't make anything complicated and show it as simple as it is. Perfect video. Thank you so much John, i hope you have a nice day!
YHEAA
i'm from Brazil,and by the first time,i understood how this work
Same here🎉😅
really astounded that there aren't more clear cut tutorials/explanations about buffered reader/writer on YT. Thanks for the video!
For anyone that does not know, you can use "try with resources" instead of closing the buffered items (and everything that implements closeable interface)
In the latest java versions at least, you can only use try-with-resources when something implements AutoClosable
You have no idea how happy I am when I search something related to Java and your video pops up.
I've worked in this industry for years but as a lower level tech employee and am needing to brush up again. These tutorials are just fantastic. If you can understand why you'd do things this really clears up the rest. To boot, they are really concise and nicely made. Thanks man I do appreciate it.
Perfect video. I can't begin to explain to you the confusion college classes give when explaining this type of stuff. Its great to have you as a resource for learning what they lack to teach properly. Much thanks, John.
Yeah.. as someone pointed out.. try-with-resources is a good way to show best practice for any resource that implements closeable .. something like this
try (BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt"))) {
writer.write("Writing to a file");
} catch (Exception e) {
e.printStackTrace();
}
Each time I am struggling with a notion on CodeGym I am on the lookout for one of your videos. And each time it gets crystal clear when you explain it. Thank you so much for your work !
you just help me finish a whole assignment in two hour over 3 videos, i appreciate you
thank you for your excellency. now i don't need to check anywhere for reading and writing file. Millions of thanks
You're an absolute god-send. I've been struggling with these last couple weeks of the semester, but you're able to explain these concepts so easily with clear examples to help walk us through them. You're great!
What? A concise, clearly-explained tutorial on TH-cam? Subbed. 👍
We were given an assignment to code all kinds of shapes, and the lecturer deliberately did not teach how to save files. And I asked him why they don't teach, but they did put it in the assignment, he said he wants us to learn to code and think twice about how everything works, only after watching your video, I understood the meaning of why he wanted it, there won't always be someone next to you to tell you, this is the stage you need study alone and look for answers
watching this right before my OOP exam, you're a life saver
This is the easiest way to understand the I/O. The university teacher and other youtubers make this a tedious topic, but you made it so much easier. Thanks a lot!
I watched this video, wrote some code and it works, Now I can reaaly write to and read from a file. Finally I wrote something that works. Thanks John!
This is the first educational video I have slowed down the playback speed because I want to get every detail possible.
As a JS engineer after starting to learn JAVA I've been wondering why every JAVA tutorial is recoreded in 320p quality with shitty audio !!!! finally a java tutorial with JS tutorials standards lol thank you so much.
Hey John, regarding the 'while' loop, I'd rather simply implement it using '.ready()' i.e.:
while (reader.ready())
System.out.println(reader.readLine());
Which does exactly the same thing as your code.
Thank you for the great content and best regards !
Woah! This is great. Thanks for sharing !!
Thank you! I kept getting a blank output, just needed to close the writer. God bless!
That is an old and complicated way. The easiest way is to just put your lines in a list and call :
Files.write("path","your list") ;
That's all. You also need to handle the ioException though.
Reading is simple too:
List lines = Files.read("path").collect(Collectors.toList());
will there be any performance issues if we use this
@@francis.joseph I'm not sure but a raw loop with a filewriter is probably faster. But the point in this method is simplicity and reliability. Also 9/10 such performance differences are not important. If you write to a file many times a second you should think about refactoring the code and buffer the data.
When I see your videos feels like Java is too easy but when I go to actually programming my brain just reseted
thanks man you are like a savior in the hard times almost makes me wanna cry
Man, I keep finding great video lessons like this that do a better job of explaining and teaching than my own PROFESSORS do. It is fucked up how expensive College is for what we get out of it aside from "certification", essentially, and a way to officially show we have taken the courses.
You should close the resources in finally block or use a try with resources to guarantee the resources are closed. If you don't do this and there is some exception while running the writes, the resource will never be closed.
Amazing, thank you for making this, very engaged with your viewers. This man is going places!
More clear than my teacher's explanation regarding Java IO! Thanks for the video so much❤
You always come in clutch John. I was taught how to do this a year ago and I haven't had to use it since but this was a great refresher. Thank you!
lol, shameless plug of your course at beginning.... I hear less than 3 min of you speak and now I'm looking at that course like it's a nicely made steak dinner! Fantastic content! Both java knowledge and ability to teach!!!
A very beautiful and calm way of redirecting knowledge! Respect
This would be a good place to use Java’s try-with-resources statement which automatically close the file when leaving a code block.
For a small program like this, main() can also be declared as “void main(String[] args) throws IOException” which would end the program and print a stack trace in case of error.
Thanks alot! So much easier than reading a lecture note when you have such an in depth summary
This man is going places
Pls upload more vdos as i cant afford to spend more online .... You are my only hope towards fun learning...pls make every type vdo related coding ... i will watch and learn them all..
Your way of explaining is very good. You kinda like go through the way of thinking, your explanation is in a very logical order. I'm very impressed, very good 👍🏻
if you create a PrintWriter instead of BufferedReader it comes with the normal print statements (print, println, printf) which is much easier and more familiar
Ok, this videos was awesome. Currently taking Udemy’s “Java Programming Master Class” it’s very in-depth…and I’m always looking for Channels/videos like your to fill in the gaps and give a different/simpler explanation on what seems to be complex topics. You should offer private lessons in addition to your Course. IMHO. 🙌🏿🙌🏿🙌🏿
If I can figure out a good way to do that when I have time, that's certainly an idea!
@@CodingWithJohn I think it would be a very complimentary “course” for that course if nothing else. Just A Thought….
P.S. I will be visiting your other vids to reinforce and fill in the gaps in other topics/areas in Java. e.g “LinkedList” ans pointers lmao..
@@mastershonobi110 hey I’m taking that same class.
@@DragonOfTheWest412 how far in are you???
@@mastershonobi110 section 8 almost on 9 how about you ?
YOU ARE THE GOAT BRO TY, AM FRENCH STUDENT AND YOU HELP ME SO MUCH, love you
You nailed it. A crystal clear explanation.
You make it so easy to understand, thank you!
Thanks for the great video. I'm a freshman in college studying CS and videos like this really help me get my projects done on time.
Thanks for this bro, beginner here, and this really helped me a lot.
Amazing work man! Helps a lot for revising(Learning everything from scratch) for uni exmas! Keep it up!
This video really helped me learn File Input/Output properly. Btw, does it matter whether we choose File or Buffer Reader & Writer?
I have never seen a tutorial like this. Very cool
Thanks, John. This was clear, concise, and educational.
Very fantastic sir, the you was explaining that show how much you are cleared about concepts, thanks again master !!
Thank you so much. You explain everything so easy and methodically.
I am learning Java in Stockholm Sweden. Have a good evening!
It's good to have a "go to" set of objects/methods for this kind of work. I like the BufferedReader/Writer approach and if I'm not mistaken it will even scale up and allow an efficient job with larger data.
I like the way you make every topic in java easy to understand. Please do more java videos
Very Helpful Video. Please do a video on Serialization and De-serialization in JAVA with relevant examples. Thanks
I heart you John! You make learning Java clear and understandable. Thank you for helping me learn more and drink less...(coffee). Cheers!
I am a fan of your classes, simple and advanced. god job. Keep going
Super method of teaching,able to understand hard concepts though..
clear, concise and honestly reminds me that Java can be easier to manage than C
It's been about 15 years since I've needed to code in C and I can't say I've missed it
@@CodingWithJohn haha
Thanks for making this concept much more understandable
정말 좋은 수업 매일 매일 듣고 있습니다. 감사합니다. SUper easy to study.
Always used scanner for this sort of things, and when I first time saw this monstrosity of a code at algorythmic test, I was terrified. Thanks to your tutorial now I uderstand it is preatty useful and easy to use. Thanks a lot and keep up the good work.
I just can't stop watching you! Keep it going :)
oh, finally understood this topic, thanks! You are the best Java teacher!
It's better to use try with resources because close() may not get called if the readLine() or write() throws an exception
I like ypu channel very much!!! You are my favorite englishspeaker youtube bloger, who makes Java Tutorials!!!
You're a gem. Keep going brother. Subbed.
Thanks for being very understandable and simple, I’ve been kinda struggling with this.
You were so clear and easy to understand. Thank you.
You are one of the best who made this reader and writer concept look so simple and I really appreciate you work and effort. Thank you !
Thanks...Have a nice day!!
This is very useful! Thank you for making this video!
Watching this for advent of code. Thanks!
Update: I can't do it. 😢
listen here u bastard.
my professor has tried to teach it but couldnt make it that clear as u do it.
u really are the goat.
Your videos are so clear and concise, tysm!
thank you, that was super easy to follow
logical stuff in a few minutes. nice work
I just found my Java tutor, thank you God
John your videos are amazing and helping me so much with my studies in software development!
Keep doing what you are doing!
At 2:30, actually the set is written on the fly even without the close() method being called.
Edit: My bad, I used a Try With Resources, that's why I didn't need to call close() which is called automatically with TWR.
you make everything clear and simple. Thank you!
John, this is awesome! I really appreciate this tutorial.
felt like I understood a lot, but can you make a video about solving some mediocre level questions of file handling
I love your videos, straight on point and easy to understand.
diificult concepts seem very ease when they are taught by u
Liked, shared, subscribed, commented... Loving your content, thank you!
Every youtuber needs to know your location lol
Greatly explained....Need more contents ! :D
Thank you for creating such informative and helpful content. Your explanation of Java File Input/Output made a difference in understanding this complex concept.
P.S. wrote/read the above comments from this lesson FileIO in Eclipse! Thanks
If someone doesn't wanna deal with a try-catch block everytime you wanna create or read a file, simple declare your main function like this:
public static void main(String args[]) throws IOException
{
... //Your code goes here
}
Thank you ❤❤🥰🥰
Your videos are always needed. Thanks
Thanks a lot, John. You're really my saver there on my way to master Java !!!
but what if the text made of a lot of paragraphs and it needs an empty line whenever has a new paragraph, will the read code still works? anyway, great video, thanks sir John!
You awesome man, that was super easy to follow!
thanks for clear explanation.
thanks John, what a smooth explanation, i got it)
Can you please create a video to compare ip/Op .xls file with some transformation logic applied.
John, god bless you! You are a amazing teacher!
this is a perfect explanation , thank you sooo mucchhhhhhhh
Thank you! John . For being my compiler .
This video deserves more views!
great job, u made it looks so simple!! love it
im using a print writer most of the time
the best video that I've ever seen