Files In Java - Read Text File Easily #38
HTML-код
- Опубликовано: 12 дек 2018
- $1,000 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE. See if you qualify for the JOB GUARANTEE! 👉 bit.ly/3HX970h
I show you exactly how to read and write files in java! ✅ Simply write this code to open the file and get the text from it line by line using a scanner.
Learn java in just 13 minutes: • Learn Java in 14 Minut...
The text file I used: textfiles.com/100/captmidn.txt
It's really easy to read and write files in java! First, open the file by creating using File("path/to/file.txt"); then scan through the file line by line using Scanner to read from the file. If you want to write to a new file simply use FileWriter(""path/to/newfile.txt"");
You'll get the hang of reading from files and writing to files in java! They aren't too bad :) To read file line by line and to write a file in java are very similar. There a few quirks like importing the libraries and adding the "Exceptions" but once you get those and the paths right, you should be good to go!
💻 Source Code: github.com/alexlorenlee/JavaT...
I hope you enjoyed this files in java tutorial! I like to have a nice mix of tutorials and actual projects for you all :)
Do you want to learn how to code from scratch, in Java? Check out my Java Tutorial For Beginners: • Coding For Beginners I...
Was this helpful for you? If you have questions about reading files in java or writing files in java, please ask in the comments, there are a lot of people just like you
Full Java Tutorial For Beginners Playlist: • Full Java Course by Al...
Free Tips: bit.ly/3U6HXcb
Disclosure: The Springboard link provided is linked to my affiliate account & supports the channel.
~
Alex Lee
If you’re new to programming but want a career in tech, I HIGHLY RECOMMEND applying to one of Springboard’s online coding bootcamps (use code ALEXLEE for $1,000 off): bit.ly/3HX970h
It is hilarious to me that my computer science teacher spent an hour and a half lecturing of files and I didnt understand a single second of it, and then after watching you actually work in java for 7 minutes I understand.
I've got the same issue man. My uni lecturer is a brilliant programmer, but an absolute garbage teacher. No body in my class is learning, because for first year students he's expecting the output of veteran programmers. If anyone asks for clarification he's very patronising and if anyone challenges him on a topic he cuts them down with his knowledge and makes them question if they're right or wrong. Even when you do the research and know you're 100% right. Sadly this seems to be common place. Very few programmers are good teachers. Most are good at one or the other. Alex *IS* one of the good ones. If Alex was my lecturer I'd actually _want_ to be a programmer. I probably say that because my lecturer has left me so jaded.
Comments like this started getting annoying me
Teacher Phobia!!!!
This is called Talent my friend :)
I am INSANELY horrible at math but I'm INSANELY good at doing math in java and javascript and other programming languages;
Having watched a ton of java tutorials, I can easily say this video is one of the clearest, efficiently communicated videos out there with a good level of production value. I can't say thank you enough for that! Count me as subscribed...
Keep up the good work.. You're a lot underrated at the moment
A friend recently sent my this video and I can quite say that it made my day. Your tutorials are incredibly useful and easy to follow. Thanks and keep up the good work!
you simply make the best videos about those kind of things. every time i watch them they are super helpful and easy to understand. Ive been really struggeling with programming lately and u saved me so many times!
THANK YOU
You have no idea how helpful your videos are, thank you soooo much!!!! You break everything down in such a concise way. My final is tomorrow and just after watching this I feel so much better already. Hats off to you sir
Thank you! This video was very helpful. I felt so dumb not being able to figure out how to do this, but you really made it straight-forward.
this is the only tutorial which really taught me this file reading/saving thing.. man you are a great teacher. its true that anyone can be anyone's teacher.. age doesn't matter. ty man.
Alex, I can really say how much your videos help me ... keep up the good job !
i have a 2 whole books about java and files 2 hours in class 2 videos and still didnt understand files till i saw your video. you so underrated thank you!!!!!
I love how you explain things in detail, hope to see more java programs.
Thank you so much. As previously stated, people over teach this waaaayyy too much and make it super confusing, but you made it so simple and I was able to finally finish my project. Thank you!!
Well he didn't close the scanner. This is not a good idea! And not handling the exceptions is not recommendable either.
you know, you've been doing coding tutorials for at least 4+ years at the time i'm writing this comment and all of the videos you make are just crazy at the quality and the way that you explain things to make them seem so simple. i hope you keep doing this for a while and i really think you deserve more subscribers cause you are incredible at this.
oh God !!! finally found such a video which I was searching for, for a week. Thank you so much. No one taught as you did.
I had zero understanding of file i/o and this video helped me understand so much so easily! Thank you :)
Great video man! This video really broke it the process down quickly and easily. You've gained a sub from me
If not the best channel about Java, def. top 3. Thanks a lot Sir
Your videos are helping me in my object oriented programming class four years after you made them! THANK YOU!
Man i rarely comment on youtube videos but i am a programming student and watching you solved soooo many problems i had in so easy and simple way. Ty and keep up the great work!!
Bro, you just summed up an entire chapter for me in 7 min. Thank you so much!!!
Have been struggling in my Java courses for the last year and since finding your channel things are finally starting to make sense. By far the best Java tutorials on youtube. xxx
You are beautiful
@@tarnum113 Don't be a creep
@@bogart9010 ikr
Salute!!!, 3 years after and your explanation still the best!!
Thank you, I was struggling with my Computer Science assignment. Appreciate the quick tip!👍🏾
You have the best tutorials mate. Keep it up!
I absolutely love your videos. They're extremely helpful!
This guy is too much! So simple and easy to follow, thank you Alex.
Thanks dude......i was struggling for hours with this concept and now i understood it in just 7 minutes
Thank you very much for this neatly done video! I learned more than what I thought I wanted to learn!
Fantastic tutorial. Video complexity and length were perfect
You save me in every java project I need! Love you!
hey man I love your videos thank you so much for making this playlist.
It is clear and concise in a good way, Thanks 🙏🏻
Hey man im becoming your fan because you are helping me alot in my semester.big thumbs up
Such a tech god, and u right the 3000 I think was the key to the full potential of the program, keep it up, chief
You can be everywhere in the world but you are here with me. And I appreciate it. ❤️❤️❤️
Very helpful and straight to the point. Thanks a million :)
thank you so much for this, this is really helping me for my finals
Your Java tutorials are the best man.
Thank you so much! you are my life saver! I was able to submit my assignment because of your video!
Love the video, just no music is distracting. Thanks for making it!
Very efficient way of explaining. Thank you.
Thanks! Had to learn this for a class project.
Simple is beautiful! Thanks!
When I'm following your videos, I'm in the habit of adding your later code points instead of replacing the earlier content. For this one I found that since the scanner had already reached the end of file printing to the console, when I called the writer the scanner would profile nothing. Since I don't know of a way to reset the scanner to line 0, I figured what I should do is put the scanner process into a new method which returns a string. It worked! But then I noticed that I wasn't using our File file, and then had to think about refactoring: keep the method using a file path string parameter, or change it to take a File object directly? whyNotBoth?.gif, which then got me thinking of method overrides and polymorphism and damn, it's good content.
You give the viewer a rock solid example of a feature, which puts them into a strong position to extend upon it as they see fit and integrate it with other things. Top notch!
My dawg came through for me yet again! Thanks Alex!
Great content.. very beginner friendly
love from India❤️🙏
What a life saving video to come into my recommended.
Love your vintage apple keyboard, very nice typing sound!
I love how straightforward you are. Greetings from Kurdistan of Iraq.
dude thank you so much you are incredibly helpful
Thanks for making this video, very informative, it is simple and easy to follow, thanks a lot.
I just subscribed your channel its awesome. keep it up buddy
switching for medical lab tech to developing has been rough…not to mention its online and through Capella so I’m basically teaching myself.. your videos have been a godsend.
This is really helpful and your topics are spot on to what I am looking for. I am just starting in Java, and your video is fast, easy to understand and concise. This is exactly how a youtube tutorial should be.
I continue to learn more from your videos than my professors. Great job! Any chance of showing out to save/print data input from a user? For example, user inputs request which is scanned against an array, then when done, prints a summary of what the user scanned.
Thank you, you always help me, I am so grateful
the best, I'm learning more from you than my prof's.
You are awesome, man! Keep going!
thank you a LOT for making this tutorial!
Thanks a lot brother. I am new in java and this video helped me a lot. again thanks👌👌👏👏
Super helpful, thank you for your service.
ALEX, u made my day. Thanks!!!!!
Thank you, sir! You saved my mid-term🥺
this video is not about Scanner but now I actually understood what Scanner is
THANK YOU IT WORKEDDDD FINALLY AFTER HOURS OF RESEARCH
Thank you very much for this video! I've subscribed to your channel already:)
Love this channel. Please keep on making new content
It really helped a lot keep it up :)
Thank You So Much It was super helpful ❤️❤️
I swear it's one of the best video on files...
Would you consider making a tutorial like this but for a bufferedReader? I'd look at other people's videos but yours are clear and easy to understand!
Thank you very useful!
This is really great teaching. Thanks very much for the help :)
Really nice tutorial, tysm
Thank you, this helped me so much.
you are really a very good tutor!!! keep it up. God bless you!!!
I've been learnt English already sometimes(I'm from Ukraine), my level is low but I've understood all of this video. I think it's that because you speak very clearly. Great job!
thanks queen love your videos
I am a 43 year old bassoonist who decided to go back to school for a BA/MS computer science/IT degree. I have had 50% fewer meltdowns since discovering your channel. You are a lifesaver, and I'm buying a teeshirt.
Thats the video I want. Simple and easy to understand. I am doing cs minor right now and our lecturer spent 1hour to teach this topic. I wish you were my lecturer :(
Nice and precise!!
Thank you so much !!
you are absolutely awesome man ...keep going
Wow well done. keep up the hard work.
You are just amazing, thank you so much!
thankz bro!
Wonderful. thank you. I have subscribed. I hope that you have a long and successful career : )
ngl i'm laughing rn
I've my exams in a couple days and i literally have no concept in file handling
i was going through every available videos in yt and i was getting more and more confused then i stumbled upon this gem
thanks mate ..... you just saved me
Great Job @alex lee, TY.
I needed this. Thx
Saved my day! Thank you very much!
You are a really awesome teacher.
nice, simple, does the job. thanks
Thank you very much!!!
it was so easy , thank you
Really u are awesome... You just made my day!!!
You're the best teacher for Java!!!!
You are my actual Java teacher
Thank you very helpful for my AP Computer Science class