Тёмный

Java File class 📁 

Bro Code
Подписаться 2,2 млн
Просмотров 87 тыс.
50% 1

Java File class tutorial example
#Java #File #class #tutorial #example
import java.io.File;
public class Main {
public static void main(String[] args) {
// file = An abstract representation of file and directory pathnames
File file = new File("secret_message.txt");
if(file.exists()) {
System.out.println("That file exists! :O!");
System.out.println(file.getPath());
System.out.println(file.getAbsolutePath());
System.out.println(file.isFile());
file.delete();
}
else {
System.out.println("That file doesn't exist :(");
}
}
}

Опубликовано:

 

6 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 141   
@_Anna_Nass_
@_Anna_Nass_ 2 года назад
Hey bro, I just got a 97% on my final in my Java class and I wanted to say THANK YOU for helping to make that happen.
@BroCodez
@BroCodez 2 года назад
good work!
@UltraSolarGod
@UltraSolarGod 2 года назад
did you copy from google ?? xD
@clarkvaughan
@clarkvaughan Год назад
Congratulations! Onward you go!👏
@clarkvaughan
@clarkvaughan Год назад
My physics teacher was famous for saying, "Everything technical is not difficult, and everything difficult is not technical." I chewed on that for years. I think what he meant was to look for easy ways to solve problems when it's the right thing to do. Files are just files. A short video tuutorial is enough. Make it easy on yourself, because non-technical challenges await. Take care
@liliacfury
@liliacfury 3 года назад
We love seeing a file in his desktop saying nuclear launch codes 😂
@zai_ry11
@zai_ry11 8 месяцев назад
bro 😂
@affable.pebble
@affable.pebble 2 месяца назад
💀
@millejadecabrera4544
@millejadecabrera4544 3 года назад
This playlist was really helpful. You made it easy for us without consuming a huge amount of time.
@maxwong1768
@maxwong1768 2 года назад
If I use the relative filename , the java can't find that txt file . There are 3 solutions 1) type "src\\message.txt" or "src/message.txt" . 2) Change the eclipse working directory to the absolute pathname of the folder (src) that contains your packages and txt file . By doing that , you can click section in top bar [Run] -> [Run Configurations] -> [Arguments] -> [Working directory] -> change from [Default] radio button to [Other] , enter your absolute pathname after [Other] -> [Apply] -> [Run] 3) type the absolute pathname .
@flick4556
@flick4556 2 года назад
How do i find my absolute pathname??
@maxwong1768
@maxwong1768 2 года назад
@@flick4556 right-click the txt.file in eclipse -> [properties] -> location
@Blackilykat
@Blackilykat 2 года назад
NOTE: if file.exists() always returns false, make sure to inclute /src before the name. For some reason java thinks that main.java is in the project folder when its actually in /src.
@deptjeach4055
@deptjeach4055 2 года назад
That just helps me
@qwerttz1033
@qwerttz1033 2 года назад
isn't it src/ and not /src?
@Blackilykat
@Blackilykat 2 года назад
@@WorstDruidEU yeah lol i was really confused for quite a bit
@ibrahimylmaz8378
@ibrahimylmaz8378 2 года назад
System.out.println("YOU ARE THE MAN, MAN!");
@yishay3387
@yishay3387 2 года назад
thank you so much
@asgoritolinasgoritolino7708
What a useful programming video, and by a person who actually talks english! Amazing.
@BroCodez
@BroCodez 4 года назад
import java.io.File; public class Main { public static void main(String[] args) { // file = An abstract representation of file and directory pathnames File file = new File("secret_message.txt"); if(file.exists()) { System.out.println("That file exists! :O!"); System.out.println(file.getPath()); System.out.println(file.getAbsolutePath()); System.out.println(file.isFile()); file.delete(); } else { System.out.println("That file doesn't exist :("); } } }
@charlesclairvoyance
@charlesclairvoyance 3 года назад
This helped more than you could understand, thank you!
@hannibalbianchi1466
@hannibalbianchi1466 3 года назад
Thank you sir you are the most amazing teacher I've ever seen 👍
@dianamilenaarchilacordoba4632
@dianamilenaarchilacordoba4632 20 дней назад
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
@AdrianTregoning
@AdrianTregoning 2 года назад
Nuclear launch codes 🤣 I had a good laugh now.
@mostwanted9817
@mostwanted9817 2 года назад
"Please excuse the mess". Me:**starts breathing heavily knowing I have over 50+ files on my desktop**
@oscarjosefsson9300
@oscarjosefsson9300 Год назад
So, as some people have already pointed out. Sometimes you need to enter the complete path for the file. You can see what that path is by right-clicking the file in the project tree and choose "Properties". Then copy all of that and use it instead of just the file name.
@ultronthor.
@ultronthor. 3 месяца назад
That just helped me now😭😭. Thank you unknown helper 💗💗
@akkiyethi
@akkiyethi Год назад
Keep your text file outside your src folder incase if file.exists() always returns false...
@sunnydforfree7145
@sunnydforfree7145 Год назад
Thanks.
@cdjosh3568
@cdjosh3568 4 года назад
WE back at it again, epic vid homie
@BroCodez
@BroCodez 4 года назад
let's gooooooooo
@higiniofuentes2551
@higiniofuentes2551 6 месяцев назад
Thank you for this very useful video!
@chillybacha8007
@chillybacha8007 4 месяца назад
Hey, Thank you for the awsome learning experience... You've been a great help through my Java class this term. :)
@hesham4744
@hesham4744 2 года назад
اقسم بالله عظمة !!
@TheRickyfranco13
@TheRickyfranco13 Год назад
Awesome video, I love the way you explain new concepts
@farmgatebd7858
@farmgatebd7858 3 года назад
Waiting for DataStructure in java full Video , Please keep going, and thank You.
@nimbcorp
@nimbcorp 27 дней назад
good one, nice video.
@affable.pebble
@affable.pebble 2 месяца назад
Cool! Easy to follow
@alesto8962
@alesto8962 3 года назад
Love your videos! Everything becomes so easy
@emmalund7859
@emmalund7859 2 года назад
Here's a prayer to the youtube algorithm. :D Thank you Bro Code for amazing videos!
@adrian_vsk7203
@adrian_vsk7203 3 года назад
I find these videos so helpful. One problem I have with files though is when I make an installer for an application which allows a user to define where they want to install to, how can I set that file path then back in the application so it reads and writes to that file?
@abbasmohammed5567
@abbasmohammed5567 3 года назад
Thank you Bro code !!! Appreciate your work man ... Keep up the good work .
@troddennabcodm9246
@troddennabcodm9246 3 года назад
He is a legend,gamer+programmer
@foxyzorritoplayer2220
@foxyzorritoplayer2220 5 месяцев назад
Best RU-vid teacher ever
@Dragon__734
@Dragon__734 2 года назад
Thank you for all your work on these videos
@dogr9
@dogr9 2 года назад
Hey i got a problem with my Intelidea that the program doesn't recognize the file for an unknown reason, showing on console that file doesn't exist... Only when i put full path, than all works fine..
@ZeAfonso21
@ZeAfonso21 2 года назад
yes it happens for me too! i'm using linux so maybe it has something to do with that..... idk
@jeelpatel54
@jeelpatel54 8 месяцев назад
love your technique bro
@learnwith_saikat
@learnwith_saikat 3 месяца назад
I am loving with bro code for his coding content.
@soumelee5661
@soumelee5661 Год назад
thanks very nice vid & explanation
@danny.3036
@danny.3036 3 года назад
Thanks, Bro! ☕ You're awesome!
@seahawks8801
@seahawks8801 3 года назад
Thanks Bro for this awesome videos, stop making Java easy to understand
@rahelina7176
@rahelina7176 Год назад
Thanks! Cramming and my prof didn't cover this topic :/
@imie5762
@imie5762 2 года назад
I don't quite understand the file.delete part. Shouldn't the program every time you start it create a file (File file = new File("poem.txt");) , so eventually only the first condition of if statement (file.exists()) would be fulfilled. I know the file gets deleted by the end, but with another start of the program it is created again. So like, why every other start of the program ignores the File file = new File(); line.
@tradoson6493
@tradoson6493 Год назад
beautiful work my lord
@philosyche
@philosyche 3 дня назад
thank for this
@potatoesislife6365
@potatoesislife6365 6 месяцев назад
Dude you are amazing!
@eugenezuev7349
@eugenezuev7349 5 месяцев назад
nice
@fitzsimmons7
@fitzsimmons7 8 месяцев назад
super helpful, thanks bro
@pushankarmakar1783
@pushankarmakar1783 2 года назад
thakyou so much for the videos
@ABC-zv1sd
@ABC-zv1sd 2 года назад
Hello, I am developing android java filemanager app.. I used checkbox to check 1/file.mp4 2/folder(files+sub folders) . How can i add copy paste feature for checked 1, 2 file folder fully at same time ?like -google filemanager app.. Advance Thanks
@maleeshanethmi5156
@maleeshanethmi5156 Год назад
Short N Sweet
@mehedis_creation
@mehedis_creation Год назад
sheiii bro
@eduardofabris8523
@eduardofabris8523 2 года назад
love the easter eggs
@wombozombo
@wombozombo 2 дня назад
💪
@artempeshkov5659
@artempeshkov5659 5 месяцев назад
super
@vijaysinhkhot2871
@vijaysinhkhot2871 Год назад
Thanks a lot!
@bharathpavurala7817
@bharathpavurala7817 2 года назад
You are just awesome 😎
@曾毓哲-b1t
@曾毓哲-b1t Год назад
Thank you very much
@ajdndbdjbdj
@ajdndbdjbdj Год назад
Hello , i have a question please , i did all the instructions but it shows no file for some reason , why is that ? Edit: its ok comments already answered that , keep the great work man
@danielmilewski7659
@danielmilewski7659 2 года назад
thanks! really well explained!
@minhtetpaing1695
@minhtetpaing1695 3 года назад
Thank you so much sir.
@botelhocpp
@botelhocpp 2 года назад
Amazing bro!
@renecabuhan1675
@renecabuhan1675 3 года назад
Bro I learn a lot from you thank you
@kemann3815
@kemann3815 2 года назад
Just the best
@mudassirnaz1813
@mudassirnaz1813 3 года назад
thanks
@revanth9272
@revanth9272 3 года назад
Simply superb👍
@BroCodez
@BroCodez 3 года назад
thanks for watching Lakkoju!
@hurrianhymn9571
@hurrianhymn9571 3 года назад
keep the good work up brother
@adeelahmaddev.9346
@adeelahmaddev.9346 3 года назад
Great!
@adnanhabib3059
@adnanhabib3059 Год назад
you are realy helpful bro. :)
@longkesh1971
@longkesh1971 Год назад
Thanks bro.
@baracuxxo2497
@baracuxxo2497 2 года назад
nice video
@uchihalayan3435
@uchihalayan3435 5 месяцев назад
thank you bro
@sushantlama9010
@sushantlama9010 3 года назад
nice video buddy...
@juhyeonyu
@juhyeonyu 3 года назад
who can resist this thumbnail
@daemonkit
@daemonkit 3 года назад
Good video!!
@pa-305
@pa-305 3 года назад
best brooo
@kenaz3066
@kenaz3066 2 года назад
I do have a file but it won’t full the array
@MrLoser-ks2xn
@MrLoser-ks2xn 2 года назад
Thanks
@felion5574
@felion5574 Год назад
thank you, you are the best : >
@romario92730
@romario92730 3 года назад
Thanks, Bro!
@Simis999
@Simis999 2 года назад
Don't we have to close the file afterwards?
@ibrahimylmaz8378
@ibrahimylmaz8378 2 года назад
thanks bro
@hunkywarrior3492
@hunkywarrior3492 3 года назад
best bro ever!
@greeneggsandmushrooms9855
@greeneggsandmushrooms9855 3 года назад
i'm hungry
@efril802
@efril802 3 года назад
still hungry?
@echelon721
@echelon721 2 года назад
Bro i just want u to know; you re saving my ass ! thank u soo much !!!
@Roldan-zs7nq
@Roldan-zs7nq 5 месяцев назад
I love you bro
@OluwarotimiOjo
@OluwarotimiOjo 5 месяцев назад
Goat
@srijaya7246
@srijaya7246 Год назад
😇❤
@ryadkurobike369
@ryadkurobike369 3 года назад
can i have the Nuclear launch codes pls AHAHAHA
@Abaddon-u1i
@Abaddon-u1i 3 месяца назад
Thank you bro, comment for the bro code
@sofinesun1664
@sofinesun1664 3 года назад
EPIC
@johneltins9822
@johneltins9822 3 года назад
dude you live in my heart S2
@alexyakoveno4682
@alexyakoveno4682 2 года назад
@leoxu7826
@leoxu7826 3 года назад
nice 2.0
@GOODBOY-vt1cf
@GOODBOY-vt1cf 3 года назад
4:38
@harshnitnaware9143
@harshnitnaware9143 2 года назад
hey bro can you paste the code in the comment
@aboyiphilippa1136
@aboyiphilippa1136 6 месяцев назад
@cirrusyk
@cirrusyk 2 года назад
nuclear launch codes... 💀💀💀💀💀💀
@youssefnajim9740
@youssefnajim9740 Год назад
come on bro we want spring framework and spring boot
@prajwaldeepkhokhar7416
@prajwaldeepkhokhar7416 3 года назад
"NUCLEAR LAUNCH CODES" XDDDDDDDDDDDD i wanna know what the fuck exactly resides in that XDDDDDDDDDDDDDDD
@joyceasante8292
@joyceasante8292 Год назад
import java.io.File; public class Main { public static void main(String[] args){ File file = new File("song_lyrics.txt"); if(file.exists()){ System.out.println("That file exists! :O!"); System.out.println(file.getPath()); System.out.println(file.getAbsolutePath()); System.out.println(file.isFile()); file.delete(); } else{ System.out.println("File does not exist"); } } }
@wallstreetbets7741
@wallstreetbets7741 2 года назад
Watch now
@gogoi.
@gogoi. 3 года назад
I click your ads bro !!
@cool_huip_
@cool_huip_ 2 года назад
Add a public comment...
@zstar8397
@zstar8397 Год назад
Yo just wanna say that GOD loved the world so much he sent his only begotten son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply believing in him (Jesus) asking for the forgiveness of your sins and forming a relationship with heavenly father.
@zyx2151
@zyx2151 2 года назад
A comment
Далее
Java FileWriter (write to a file) 📝
3:51
Просмотров 93 тыс.
Java multithreading 🧶
15:18
Просмотров 129 тыс.
ЛЮБИТЕ ШКОЛУ?😁​⁠​⁠@osssadchiy
00:20
КОТЯТА НАУЧИЛИСЬ ГОВОРИТЬ#cat
00:13
Java serialization 🥣
21:13
Просмотров 76 тыс.
Java File I/O (Reading & Writing)
6:58
Просмотров 188 тыс.
Java exception handling ⚠️
7:53
Просмотров 110 тыс.
Exception Handling in Java Tutorial
13:20
Просмотров 392 тыс.
Java generics ❓
22:04
Просмотров 110 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,2 млн
Java methods 📞
11:05
Просмотров 136 тыс.
Java enum 🪐
10:50
Просмотров 66 тыс.