Java File class 📁

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 143

  • @liliacfury
    @liliacfury 4 роки тому +82

    We love seeing a file in his desktop saying nuclear launch codes 😂

  • @_Anna_Nass_
    @_Anna_Nass_ 3 роки тому +133

    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  3 роки тому +36

      good work!

    • @UltraSolarGod
      @UltraSolarGod 3 роки тому +4

      did you copy from google ?? xD

    • @clarkvaughan
      @clarkvaughan 2 роки тому +1

      Congratulations! Onward you go!👏

    • @clarkvaughan
      @clarkvaughan 2 роки тому +11

      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

  • @millejadecabrera4544
    @millejadecabrera4544 3 роки тому +14

    This playlist was really helpful. You made it easy for us without consuming a huge amount of time.

  • @asgoritolinasgoritolino7708
    @asgoritolinasgoritolino7708 Рік тому +1

    What a useful programming video, and by a person who actually talks english!
    Amazing.

  • @BroCodez
    @BroCodez  4 роки тому +19

    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 :(");
    }
    }
    }

  • @Blackilykat
    @Blackilykat 3 роки тому +33

    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 3 роки тому +1

      That just helps me

    • @qwerttz1033
      @qwerttz1033 2 роки тому +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 роки тому +6

      System.out.println("YOU ARE THE MAN, MAN!");

    • @yishay3387
      @yishay3387 2 роки тому

      thank you so much

  • @TheRickyfranco13
    @TheRickyfranco13 Рік тому

    Awesome video, I love the way you explain new concepts

  • @dianamilenaarchilacordoba4632
    @dianamilenaarchilacordoba4632 4 місяці тому

    great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much

  • @hannibalbianchi1466
    @hannibalbianchi1466 3 роки тому +2

    Thank you sir you are the most amazing teacher I've ever seen 👍

  • @AdrianTregoning
    @AdrianTregoning 2 роки тому +2

    Nuclear launch codes 🤣 I had a good laugh now.

  • @soumelee5661
    @soumelee5661 2 роки тому

    thanks very nice vid & explanation

  • @higiniofuentes2551
    @higiniofuentes2551 9 місяців тому

    Thank you for this very useful video!

  • @maxwong1768
    @maxwong1768 2 роки тому +11

    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

    • @ibaffled.
      @ibaffled. 3 місяці тому

      I luv u

  • @hesham4744
    @hesham4744 2 роки тому +1

    اقسم بالله عظمة !!

  • @narendravarma-xo3cg
    @narendravarma-xo3cg 2 місяці тому

    hey thanks bro.learnt a lot about File class..I subscribed

  • @nimbcorp
    @nimbcorp 4 місяці тому

    good one, nice video.

  • @chillybacha8007
    @chillybacha8007 7 місяців тому

    Hey, Thank you for the awsome learning experience... You've been a great help through my Java class this term. :)

  • @pushankarmakar1783
    @pushankarmakar1783 2 роки тому

    thakyou so much for the videos

  • @maleeshanethmi5156
    @maleeshanethmi5156 Рік тому

    Short N Sweet

  • @affable.pebble
    @affable.pebble 5 місяців тому

    Cool! Easy to follow

  • @emmalund7859
    @emmalund7859 2 роки тому

    Here's a prayer to the youtube algorithm. :D Thank you Bro Code for amazing videos!

  • @alesto8962
    @alesto8962 3 роки тому +1

    Love your videos! Everything becomes so easy

  • @baracuxxo2497
    @baracuxxo2497 2 роки тому

    nice video

  • @foxyzorritoplayer2220
    @foxyzorritoplayer2220 9 місяців тому

    Best UA-cam teacher ever

  • @farmgatebd7858
    @farmgatebd7858 3 роки тому

    Waiting for DataStructure in java full Video , Please keep going, and thank You.

  • @Dragon__734
    @Dragon__734 2 роки тому

    Thank you for all your work on these videos

  • @bharathpavurala7817
    @bharathpavurala7817 2 роки тому

    You are just awesome 😎

  • @abbasmohammed5567
    @abbasmohammed5567 3 роки тому +1

    Thank you Bro code !!! Appreciate your work man ... Keep up the good work .

  • @eugenezuev7349
    @eugenezuev7349 8 місяців тому

    nice

  • @jeelpatel54
    @jeelpatel54 11 місяців тому

    love your technique
    bro

  • @artempeshkov5659
    @artempeshkov5659 8 місяців тому

    super

  • @tradoson6493
    @tradoson6493 Рік тому

    beautiful work my lord

  • @seahawks8801
    @seahawks8801 3 роки тому

    Thanks Bro for this awesome videos, stop making Java easy to understand

  • @revanth9272
    @revanth9272 4 роки тому

    Simply superb👍

    • @BroCodez
      @BroCodez  4 роки тому

      thanks for watching Lakkoju!

  • @kemann3815
    @kemann3815 3 роки тому

    Just the best

  • @troddennabcodm9246
    @troddennabcodm9246 3 роки тому +1

    He is a legend,gamer+programmer

  • @charlesclairvoyance
    @charlesclairvoyance 4 роки тому +5

    This helped more than you could understand, thank you!

  • @cdjosh3568
    @cdjosh3568 4 роки тому +3

    WE back at it again, epic vid homie

    • @BroCodez
      @BroCodez  4 роки тому +1

      let's gooooooooo

  • @曾毓哲-b1t
    @曾毓哲-b1t Рік тому

    Thank you very much

  • @learnwith_saikat
    @learnwith_saikat 6 місяців тому

    I am loving with bro code for his coding content.

  • @mostwanted9817
    @mostwanted9817 2 роки тому +1

    "Please excuse the mess".
    Me:**starts breathing heavily knowing I have over 50+ files on my desktop**

  • @fitzsimmons7
    @fitzsimmons7 Рік тому

    super helpful, thanks bro

  • @wombozombo
    @wombozombo 3 місяці тому

    💪

  • @MrLoser-ks2xn
    @MrLoser-ks2xn 2 роки тому

    Thanks

  • @minhtetpaing1695
    @minhtetpaing1695 3 роки тому

    Thank you so much sir.

  • @danny.3036
    @danny.3036 3 роки тому +1

    Thanks, Bro! ☕ You're awesome!

  • @mudassirnaz1813
    @mudassirnaz1813 3 роки тому +1

    thanks

  • @alexyakoveno4682
    @alexyakoveno4682 2 роки тому +1

  • @philosyche
    @philosyche 3 місяці тому

    thank for this

  • @oscarjosefsson9300
    @oscarjosefsson9300 2 роки тому +4

    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. 7 місяців тому

      That just helped me now😭😭. Thank you unknown helper 💗💗

  • @adeelahmaddev.9346
    @adeelahmaddev.9346 3 роки тому

    Great!

  • @hurrianhymn9571
    @hurrianhymn9571 3 роки тому

    keep the good work up brother

  • @renecabuhan1675
    @renecabuhan1675 3 роки тому

    Bro I learn a lot from you thank you

  • @longkesh1971
    @longkesh1971 Рік тому

    Thanks bro.

  • @mehedis_creation
    @mehedis_creation Рік тому

    sheiii bro

  • @adnanhabib3059
    @adnanhabib3059 Рік тому

    you are realy helpful bro. :)

  • @srijaya7246
    @srijaya7246 Рік тому

    😇❤

  • @uchihalayan3435
    @uchihalayan3435 8 місяців тому

    thank you bro

  • @eduardofabris8523
    @eduardofabris8523 3 роки тому

    love the easter eggs

  • @danielmilewski7659
    @danielmilewski7659 2 роки тому

    thanks! really well explained!

  • @vijaysinhkhot2871
    @vijaysinhkhot2871 Рік тому

    Thanks a lot!

  • @potatoesislife6365
    @potatoesislife6365 9 місяців тому

    Dude you are amazing!

  • @adrian_vsk7203
    @adrian_vsk7203 4 роки тому +1

    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?

  • @sushantlama9010
    @sushantlama9010 4 роки тому

    nice video buddy...

  • @akkiyethi
    @akkiyethi Рік тому +2

    Keep your text file outside your src folder incase if file.exists() always returns false...

  • @joyceasante8292
    @joyceasante8292 2 роки тому

    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");
    }
    }
    }

  • @rahelina7176
    @rahelina7176 Рік тому

    Thanks! Cramming and my prof didn't cover this topic :/

  • @ibrahimylmaz8378
    @ibrahimylmaz8378 2 роки тому

    thanks bro

  • @daemonkit
    @daemonkit 3 роки тому

    Good video!!

  • @pa-305
    @pa-305 3 роки тому

    best brooo

  • @juhyeonyu
    @juhyeonyu 3 роки тому

    who can resist this thumbnail

  • @dogr9
    @dogr9 3 роки тому +1

    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

  • @botelhocpp
    @botelhocpp 3 роки тому

    Amazing bro!

  • @Roldan-zs7nq
    @Roldan-zs7nq 9 місяців тому

    I love you bro

  • @echelon721
    @echelon721 3 роки тому

    Bro i just want u to know; you re saving my ass ! thank u soo much !!!

  • @Simis999
    @Simis999 2 роки тому

    Don't we have to close the file afterwards?

  • @romario92730
    @romario92730 3 роки тому

    Thanks, Bro!

  • @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.

  • @leoxu7826
    @leoxu7826 3 роки тому

    nice 2.0

  • @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

  • @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

  • @GOODBOY-vt1cf
    @GOODBOY-vt1cf 3 роки тому +1

    4:38

  • @kenaz3066
    @kenaz3066 2 роки тому

    I do have a file but it won’t full the array

  • @wallstreetbets7741
    @wallstreetbets7741 2 роки тому

    Watch now

  • @felion5574
    @felion5574 Рік тому

    thank you, you are the best : >

  • @hunkywarrior3492
    @hunkywarrior3492 3 роки тому

    best bro ever!

  • @cirrusyk
    @cirrusyk 3 роки тому

    nuclear launch codes... 💀💀💀💀💀💀

  • @greeneggsandmushrooms9855
    @greeneggsandmushrooms9855 3 роки тому +2

    i'm hungry

  • @johneltins9822
    @johneltins9822 4 роки тому

    dude you live in my heart S2

  • @OluwarotimiOjo
    @OluwarotimiOjo 9 місяців тому

    Goat

  • @Abaddon-u1i
    @Abaddon-u1i 7 місяців тому

    Thank you bro, comment for the bro code

  • @youssefnajim9740
    @youssefnajim9740 2 роки тому

    come on bro we want spring framework and spring boot

  • @ryadkurobike369
    @ryadkurobike369 3 роки тому +1

    can i have the Nuclear launch codes pls AHAHAHA

  • @sofinesun1664
    @sofinesun1664 4 роки тому

    EPIC

  • @ap1136-c4m
    @ap1136-c4m 9 місяців тому

  • @anjapietralla5767
    @anjapietralla5767 Рік тому

  • @gogoi.
    @gogoi. 4 роки тому

    I click your ads bro !!

  • @harshnitnaware9143
    @harshnitnaware9143 2 роки тому

    hey bro can you paste the code in the comment

  • @maxmustermann3273
    @maxmustermann3273 3 роки тому

    Comment

  • @cool_huip_
    @cool_huip_ 2 роки тому

    Add a public comment...