Files In Java - Read Text File Easily #38

  Рет қаралды 529,503

Alex Lee

Alex Lee

5 жыл бұрын

$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

Пікірлер: 394
@alexlorenlee
@alexlorenlee 8 ай бұрын
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
@CRAZYFASHIONTV
@CRAZYFASHIONTV 4 жыл бұрын
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.
@MrDemoncrusher
@MrDemoncrusher 4 жыл бұрын
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.
@rfederer8163
@rfederer8163 3 жыл бұрын
Comments like this started getting annoying me
@manothamareddyreddy8831
@manothamareddyreddy8831 3 жыл бұрын
Teacher Phobia!!!!
@TharaMesseroux1
@TharaMesseroux1 3 жыл бұрын
This is called Talent my friend :)
@PK-td6wp
@PK-td6wp 2 жыл бұрын
I am INSANELY horrible at math but I'm INSANELY good at doing math in java and javascript and other programming languages;
@sohagdas8351
@sohagdas8351 5 жыл бұрын
Keep up the good work.. You're a lot underrated at the moment
@pasiaomega3868
@pasiaomega3868 4 жыл бұрын
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...
@Lightning_Mike
@Lightning_Mike 3 жыл бұрын
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!
@pepe-yi6bh
@pepe-yi6bh 3 жыл бұрын
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
@LC-nk5nr
@LC-nk5nr 2 жыл бұрын
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
@joselinherrera7596
@joselinherrera7596 3 жыл бұрын
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!!!!!
@lordender_kitty_official
@lordender_kitty_official 10 ай бұрын
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.
@dansmith9859
@dansmith9859 2 жыл бұрын
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.
@mohittyagi6694
@mohittyagi6694 4 жыл бұрын
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.
@ahmadougassama6075
@ahmadougassama6075 3 жыл бұрын
Alex, I can really say how much your videos help me ... keep up the good job !
@georgetheonlyone1
@georgetheonlyone1 5 жыл бұрын
If not the best channel about Java, def. top 3. Thanks a lot Sir
@jesse5222
@jesse5222 2 жыл бұрын
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!!
@ronaldringelschwanz8707
@ronaldringelschwanz8707 Жыл бұрын
Well he didn't close the scanner. This is not a good idea! And not handling the exceptions is not recommendable either.
@toriredman8432
@toriredman8432 9 ай бұрын
Your videos are helping me in my object oriented programming class four years after you made them! THANK YOU!
@emmanuelkaome7153
@emmanuelkaome7153 3 жыл бұрын
Salute!!!, 3 years after and your explanation still the best!!
@mayanksingh2292
@mayanksingh2292 3 жыл бұрын
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.
@iararongindus1932
@iararongindus1932 2 жыл бұрын
I love how you explain things in detail, hope to see more java programs.
@erindoan9243
@erindoan9243 4 жыл бұрын
I had zero understanding of file i/o and this video helped me understand so much so easily! Thank you :)
@konstantinospetrakis4188
@konstantinospetrakis4188 4 жыл бұрын
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!!
@mrndc
@mrndc 3 жыл бұрын
Bro, you just summed up an entire chapter for me in 7 min. Thank you so much!!!
@Jacksonh_56
@Jacksonh_56 4 жыл бұрын
Great video man! This video really broke it the process down quickly and easily. You've gained a sub from me
@0xBK201
@0xBK201 2 жыл бұрын
This guy is too much! So simple and easy to follow, thank you Alex.
@dahaliahowell1516
@dahaliahowell1516 4 жыл бұрын
I absolutely love your videos. They're extremely helpful!
@LaysaBit
@LaysaBit 2 жыл бұрын
You save me in every java project I need! Love you!
@emzas04
@emzas04 4 жыл бұрын
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
@tarnum113
@tarnum113 2 жыл бұрын
You are beautiful
@bogart9010
@bogart9010 2 жыл бұрын
@@tarnum113 Don't be a creep
@Redstoneprojrjr
@Redstoneprojrjr 2 жыл бұрын
@@bogart9010 ikr
@suhanaislam1918
@suhanaislam1918 Жыл бұрын
Thanks dude......i was struggling for hours with this concept and now i understood it in just 7 minutes
@bernaaz
@bernaaz 4 жыл бұрын
You can be everywhere in the world but you are here with me. And I appreciate it. ❤️❤️❤️
@legalhotshotsclips
@legalhotshotsclips 4 жыл бұрын
Great content.. very beginner friendly love from India❤️🙏
@kholoudalohabi6541
@kholoudalohabi6541 2 жыл бұрын
It is clear and concise in a good way, Thanks 🙏🏻
@TPKmedia
@TPKmedia 4 жыл бұрын
You have the best tutorials mate. Keep it up!
@user-yi3qq6wb6b
@user-yi3qq6wb6b Жыл бұрын
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!
@chrahussain4109
@chrahussain4109 4 жыл бұрын
I love how straightforward you are. Greetings from Kurdistan of Iraq.
@afifkhaja
@afifkhaja 4 жыл бұрын
Fantastic tutorial. Video complexity and length were perfect
@elexushavis9334
@elexushavis9334 2 ай бұрын
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.
@KathleenCoyle
@KathleenCoyle 4 жыл бұрын
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.
@syedyusufali1073
@syedyusufali1073 4 жыл бұрын
Very efficient way of explaining. Thank you.
@akshaychauhan.5678
@akshaychauhan.5678 Жыл бұрын
hey man I love your videos thank you so much for making this playlist.
@Crowley101
@Crowley101 2 жыл бұрын
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
@mgtv6921
@mgtv6921 3 жыл бұрын
Thank you, I was struggling with my Computer Science assignment. Appreciate the quick tip!👍🏾
@markmata4464
@markmata4464 2 жыл бұрын
Thank you so much! you are my life saver! I was able to submit my assignment because of your video!
@tomino133
@tomino133 4 жыл бұрын
Your Java tutorials are the best man.
@nyrx7koe327
@nyrx7koe327 Жыл бұрын
Thank you very much for this neatly done video! I learned more than what I thought I wanted to learn!
@mattm32
@mattm32 3 жыл бұрын
ALEX, u made my day. Thanks!!!!!
@mackdudley2858
@mackdudley2858 4 жыл бұрын
thank you so much for this, this is really helping me for my finals
@fjpa654
@fjpa654 4 жыл бұрын
Love the video, just no music is distracting. Thanks for making it!
@moceasar671
@moceasar671 2 жыл бұрын
Very helpful and straight to the point. Thanks a million :)
@RishitTeclado
@RishitTeclado 3 жыл бұрын
this video is not about Scanner but now I actually understood what Scanner is
@RomanKnav
@RomanKnav 10 ай бұрын
Thanks! Had to learn this for a class project.
@avishekdhakal8056
@avishekdhakal8056 Жыл бұрын
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
@Xerxes17
@Xerxes17 3 жыл бұрын
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!
@bora_yazilim
@bora_yazilim 2 жыл бұрын
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 :(
@yoteapoyo
@yoteapoyo Жыл бұрын
Simple is beautiful! Thanks!
@avinash538
@avinash538 3 жыл бұрын
You are a really awesome teacher.
@nimrahch9337
@nimrahch9337 4 жыл бұрын
Hey man im becoming your fan because you are helping me alot in my semester.big thumbs up
@chiefsofnobles
@chiefsofnobles 2 жыл бұрын
Super helpful, thank you for your service.
@user-oc1fe4dv3n
@user-oc1fe4dv3n 2 жыл бұрын
Thank you, you always help me, I am so grateful
@manakparmar2164
@manakparmar2164 3 жыл бұрын
Thanks a lot brother. I am new in java and this video helped me a lot. again thanks👌👌👏👏
@nikhil2453
@nikhil2453 Жыл бұрын
dude thank you so much you are incredibly helpful
@mustapharaimilawal8053
@mustapharaimilawal8053 3 жыл бұрын
Thanks for making this video, very informative, it is simple and easy to follow, thanks a lot.
@xgiridharixg.b1999
@xgiridharixg.b1999 3 жыл бұрын
I swear it's one of the best video on files...
@its2467
@its2467 2 жыл бұрын
What a life saving video to come into my recommended.
@chronicallyonlineroza
@chronicallyonlineroza 4 жыл бұрын
THANK YOU IT WORKEDDDD FINALLY AFTER HOURS OF RESEARCH
@livy5x281
@livy5x281 Жыл бұрын
Thank you, sir! You saved my mid-term🥺
@Joshua-rk7bl
@Joshua-rk7bl 3 жыл бұрын
My dawg came through for me yet again! Thanks Alex!
@muhammadarslanbhatti2139
@muhammadarslanbhatti2139 5 жыл бұрын
Love this channel. Please keep on making new content
@azhar8406
@azhar8406 4 жыл бұрын
This video is amazing. Subscribed
@Brandon-qr8zz
@Brandon-qr8zz 3 жыл бұрын
Thank you very helpful for my AP Computer Science class
@benlyman115
@benlyman115 5 жыл бұрын
Quality content. Keep it up!
@alexlorenlee
@alexlorenlee 5 жыл бұрын
Ben Lyman thank you!
@jonathangerard745
@jonathangerard745 4 жыл бұрын
You're the best teacher for Java!!!!
@AntonioGarcia-rj5ms
@AntonioGarcia-rj5ms 3 жыл бұрын
It really helped a lot keep it up :)
@manothamareddyreddy8831
@manothamareddyreddy8831 3 жыл бұрын
Really u are awesome... You just made my day!!!
@_Juicy
@_Juicy 3 жыл бұрын
you are really a very good tutor!!! keep it up. God bless you!!!
@momenshtayeh67
@momenshtayeh67 Жыл бұрын
best teacher ever!!
@Daniel-jb3rt
@Daniel-jb3rt 2 жыл бұрын
Wow well done. keep up the hard work.
@waleedalkathiri8564
@waleedalkathiri8564 4 жыл бұрын
you are absolutely awesome man ...keep going
@bowiemtl
@bowiemtl 4 жыл бұрын
thank you a LOT for making this tutorial!
@tugrulavci4429
@tugrulavci4429 4 жыл бұрын
You are awesome, man! Keep going!
@peep4254
@peep4254 2 жыл бұрын
thanks queen love your videos
@vinodterry2212
@vinodterry2212 3 жыл бұрын
Thanks a lot buddy u helped me complete a micro java project Today
@Mas1o8
@Mas1o8 3 жыл бұрын
the best, I'm learning more from you than my prof's.
@anwarsosko5963
@anwarsosko5963 4 жыл бұрын
Thank You So Much It was super helpful ❤️❤️
@maxr.4030
@maxr.4030 3 жыл бұрын
Saved my day! Thank you very much!
@metaylhead9413
@metaylhead9413 Жыл бұрын
its funny because im already working as an app dev but im still here watching his video tutorial in Java coz reading alone made me so sleepy. XD Thank you!
@luke8492
@luke8492 3 жыл бұрын
Thank you, this helped me so much.
@MdAzad-hb7vc
@MdAzad-hb7vc 4 жыл бұрын
Nice and precise!!
@naorny9756
@naorny9756 10 ай бұрын
You are just amazing, thank you so much!
@WhizKidd891
@WhizKidd891 3 жыл бұрын
very good content for an exact begineer like me
@enside8822
@enside8822 2 жыл бұрын
Thank you very useful!
@myHorribleMusic
@myHorribleMusic 3 жыл бұрын
This is really great teaching. Thanks very much for the help :)
@charlesgudza9825
@charlesgudza9825 5 жыл бұрын
Great work! The video was very helpful
@alexlorenlee
@alexlorenlee 5 жыл бұрын
:)
@josemanuelmissage4396
@josemanuelmissage4396 Жыл бұрын
Great Job @alex lee, TY.
@AMANSINGH-yv4vv
@AMANSINGH-yv4vv 3 жыл бұрын
I just subscribed your channel its awesome. keep it up buddy
@mustaqahmed139
@mustaqahmed139 3 жыл бұрын
Alex Lee you are awesome👍
@rileyjones4854
@rileyjones4854 3 жыл бұрын
You are my actual Java teacher
@bhaktilatadash7619
@bhaktilatadash7619 3 жыл бұрын
Too good man ... U r the bestThank u..
@TheDebzhaus
@TheDebzhaus Жыл бұрын
Why can't everybody explain Java this clearly? Thank you for this resource!!
@juanakiss1
@juanakiss1 4 жыл бұрын
You're a life-saver!
@enriktigasna
@enriktigasna 3 жыл бұрын
Really nice tutorial, tysm
@YaiseAkuma
@YaiseAkuma 2 жыл бұрын
It's the small things like these that made me understand programming
For Each Loop In Java Tutorial #39
9:08
Alex Lee
Рет қаралды 133 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 502 М.
Me: Don't cross there's cars coming
00:16
LOL
Рет қаралды 15 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 53 МЛН
LOVE LETTER - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
00:15
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,6 МЛН
Java File Input/Output - It's Way Easier Than You Think
8:18
Coding with John
Рет қаралды 438 М.
Try Catch Java Tutorial #46
11:05
Alex Lee
Рет қаралды 216 М.
Java File I/O (Reading & Writing)
6:58
Keep On Coding
Рет қаралды 184 М.
Java FileReader (read a file) 📖
5:09
Bro Code
Рет қаралды 78 М.
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 606 М.
Return Statement in Java #27
14:38
Alex Lee
Рет қаралды 272 М.
Reading From Text Files (Java) - Basic Program
12:01
Paul Miskew
Рет қаралды 30 М.
Java: Read a CSV File into an Array #49
13:47
Alex Lee
Рет қаралды 199 М.