Java: Read a CSV File into an Array #49

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 254

  • @alexlorenlee
    @alexlorenlee  10 місяців тому +2

    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

  • @sakshi8574
    @sakshi8574 4 роки тому +84

    I'm an Engineer and graduated like a month ago. Not a single teacher in 4 years of my graduation taught me in such a good way !
    Thank you Alex ❤️🇮🇳

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

      I think Alex mentioned that he didn't have a good teacher thus he started these videos to help others. Thank God he is a world class teacher and 196K subs at this point in time speaks louder than words.

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

      Like a, month ago? Bull sht-- e(ng)ineer -- racist... EINEER -- not E(ng)lish

  • @brianparsons5709
    @brianparsons5709 3 роки тому +5

    Thank you for not only explaining yourself as you go, but also taking the time at the end to go back and explain the process line by line. You are a life saver!

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

      See this video I hope you will find it helpful. And you can subscribe also get the original code by mail. I have also get ua-cam.com/video/m--4ddPMgxo/v-deo.html
      This is the channel link

  • @m4gg197
    @m4gg197 4 роки тому +17

    4:34 BLESS YOU!
    The "wow" killed me 😂☕

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

      same here , I was laughing the whole video with that wowww . 😂😂😂😂😂😂😂

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

    I can't wait for your course. You explain topics better than most people, move at constant pace, and provide great examples.

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

    That move toward the end of your videos where you zoom out and show the entire code is so REFRESHING!!! Thanks a lot. Great job! Keep up the good work!

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

      See this video I hope you will find it helpful. And you can subscribe also get the original code by mail. I have also get ua-cam.com/video/m--4ddPMgxo/v-deo.html
      This is the channel link

  • @shazzadurrahman9750
    @shazzadurrahman9750 4 роки тому +16

    1. How to skip the first row of headline
    2. How to read the each row from csv file
    3. How to write in csv file

    • @seelyw.4818
      @seelyw.4818 3 роки тому +4

      1. put this in your while:
      if (values[0].equals("NameOfFirstHeading")) {
      continue;
      } else {
      code wich parses the columns
      }

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

      See this video I hope you will find it helpful. And you can subscribe also get the original code by mail. I have also get ua-cam.com/video/m--4ddPMgxo/v-deo.html
      This is the channel link

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

      To write into a file,
      try (PrintWriter pw = new PrintWriter(new FileWriter(file))) {
      pw.write(“data to append)
      } catch (IOException e) {
      // Handle the exception
      }

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

      It is not a good idea to read and write into the same file, it would be better to create a diff file for writing if you perform read operation simultaneously, and later if needed, files can be merged easily

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

    Again,
    The day I learn some topics in Java, you create the perfect video the eliminate my confusion. Thank You!

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

      See this video I hope you will find it helpful. And you can subscribe also get the original code by mail. I have also get ua-cam.com/video/m--4ddPMgxo/v-deo.html
      This is the channel link

  • @ap-pv7ug
    @ap-pv7ug 4 роки тому +4

    You no longer need separate catch statements to catch each individual error. You can just use a vertical pipe to separate types.

  • @mannyokafor4609
    @mannyokafor4609 4 роки тому +14

    Fifth! my fav youtuber if I am honest you deserve much more subs man just keep going Java is gonna get much more popular! Please do a video on annotations!

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

      See this video I hope you will find it helpful. And you can subscribe also get the original code by mail. I have also get ua-cam.com/video/m--4ddPMgxo/v-deo.html
      This is the channel link

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

    my first year lecturer, Alex Lee. thank you so much. this year has been tough :(

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

    4:10 start of buffered reader
    8:00 creating a String array to store entries in the line and split lines by commas

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

    You can not imagine how you helped me out with my CS lab. Thank you Alex:)

  • @Kurokage130
    @Kurokage130 4 роки тому +16

    Fourth!
    Alex you rock man this is exactly what I needed to analyze stock data! Are you a mind reader? =]

  • @FabianVirgen-gz9yl
    @FabianVirgen-gz9yl 5 місяців тому

    You've taught me more than my college professor has... lol much love Alex

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

    Go to window -> preferences -> Run/Debug -> Console -> disable "Limit console output" . Now you can see all the output.

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

    I swear this video was so helpful to me. i was looking for a more efficient method of scanning these than using a normal scanner method. you explained it in a clear way and easy for me to understand. thanks for saving my weekend :)

  • @StevenRafael268
    @StevenRafael268 2 місяці тому

    Thank you so much for this super useful video! this saved my butt with my assignment haha

  • @lesediseleke1416
    @lesediseleke1416 4 роки тому +8

    If I could I'd reference Alex only in assignments cause this is so helpful

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

    man I love your tutorials, currently taking Data Structures and the 1st project looked so overwhelming but this was more than half of it and you explained it really well :)

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

      Same lol, we may have the same prof.

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

      See this video I hope you will find it helpful. And you can subscribe also get the original code by mail. I have also get ua-cam.com/video/m--4ddPMgxo/v-deo.html
      This is the channel link

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

    Just what i needed today!
    Thank you man!!

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

    Thank you soo much it was exactly what I was looking for 2 days..

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

    You, my guy,the most unrated youtuber ever!

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

    love your tutorial, please keep going, I will watch all your videos

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

    This vid helped me a lot. Thank you Alex

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

    Don't forget to do a close() on the bufferedreader. Best to put it in a Finally{} block following try-catch.

  • @cristobalsanchez3829
    @cristobalsanchez3829 4 роки тому +89

    System.out.println(“I love your videos”);

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

    I spent 3 hours trying to figure out how to do this because my uni lecturer is awful at explaining things and makes everything overly complicated, but then I bumped into this and figured it out within the first 9 minutes.

  • @andreviniciusbezerradasilv9335

    thanks bro, your java content helped me a lot.

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

    Excellent video, thanks Alex.

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

    Alex! Excellent video and good work. You help me a lot in my studies, greetings from Argentina.

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

    your tutorials are easy to follow and fun to watch, thank you!

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

    Definitely giving kudos for the clear and concise tutorial you gave...👍
    I can't help but ask, however; Why only how to *read* ? Why not also include/explain a method of *writing* to a new or existing csv file?
    DISCLAIMER: I realize, full well, that a bigger question would obviously be why they never bought up csv/tsv files the entire time I was earning my bachelor's in this stuff. 🙄

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

    I have been struggling with Java since starting it for the last few weeks and felt like I'd given up because I couldn't get my code to do exactly what you just shown. Thank you so much... you may have just saved me from failing my Assessment :)

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

    You are doing a great job, keep it up.

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

    Oh man you're making this so much easier to digest.

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

    MAN I wish I had seen this tutorial about a month ago. I was trying to write a similar program and for the life of me couldn't figure it out

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

    You are a savior 🙏
    Best tutorials keep it up!!

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

    making videos so simple gg alex lee liked vid

  • @osamugaming1807
    @osamugaming1807 2 місяці тому

    If you are using Windows and it seems there's an Exception showing up in String path just change the \ backslash to / forward slash

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

    thank you for explaining the try/catch concept in a way I could absorb Alex 😊

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

    thank you it was really helpful

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

    Just leaving a comment so this channel gets on searches

  • @morris4622
    @morris4622 4 роки тому +7

    hi alex i love your vids about java but can you pls make a game with the JFrame plss

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

      MC Noob26 Great suggestion!

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

      I hope hé do it this Will be also good for gis vieus because that is much populier as a simpele turtorial

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

      ua-cam.com/video/gQb3dE-y1S4/v-deo.html

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

      ua-cam.com/video/gQb3dE-y1S4/v-deo.html

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

    love the video this helped me out so much

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

    could u please make a video on storing datasets into graphical neural networks using java

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

    How come I didn't find your channel earlier 😕. I am amazed man♥️♥️.

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

    This was awesome. diverting from scanner now. thanks💯

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

    This topic is so important sir.

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

    Awesome video dude. Great help.

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

    Very good explanation

  • @0xBK201
    @0xBK201 2 роки тому

    Thanks again, Alex.

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

    Thanks so much for you explain what I needed to understand!

  • @noone-hi6kq
    @noone-hi6kq 4 роки тому

    Not bad, man. I hate almost all youtubers but it is good

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

    Dude excellent video!

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

    this video is really powering me through a lab, thank you.

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

    You made it sooo easyyy. Thanks ❤

  • @noone-hi6kq
    @noone-hi6kq 4 роки тому

    Thank you very much, man, for your videos

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

    Thank you for this video.. This was very well explained...

  • @deinarudkova-schneider119
    @deinarudkova-schneider119 2 роки тому

    OMG! you are just the best!!! :D Thank you!

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

    Can you also explain how to read the csv file into two dimensional array?

  • @noone-hi6kq
    @noone-hi6kq 4 роки тому

    It is so nice when someone tells without water

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

    Why wouldn't you use the java.nio.file.Files class to read a file (from a Path object) as a String? It's a lot simpler and more readable this way.
    String[] values = Files.readString(Path.of("Path to file")).split(";");
    (might throw an IOException)
    To get an array of single lines, you could either replace the split(";") with split("
    "), get a List of all lines using Files.readAllLines(Path) or even a stream with Files.lines(path), though streams might be a little too advanced for beginners
    Iterating over the array is also easy:
    for(var value : values)
    System.out.println(value);

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

    very useful and amazing .

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

    bravo! From Italy!

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

    what if the data already has commas in it? like the address. The what to do??

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

    Thank you very much for this useful tutorial! Just one thing, I didn't catch why we need at 11: String line = "";

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

    Hey Alex is there a way to put a sound track into a java gui program?

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

      You can use InputStream ! but just convert the files to .wav or .au

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

      @@Aratussyitto I will try that! Thank you!

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

    Thanks Alex!!!

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

    can you do the same tutorial for a 2 dimensiol array? Great video tho and very easy to understand

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

    ty so much you are a king

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

    Can we ignore headers in file

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

    hey Alex, is it more common practice to put the while loop inside the try catch statement? or put a try catch inside a while loop?

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

    Thank you!

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

    dude your awesome!

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

    don't think if this is relevant, but can you make a video about creating a java multiple choice quiz using buttons. I am working on a project similar to this and I need help. Let me know what you think.

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

      Please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

    Hello there!
    Learned a lot from you :)
    Since you touched this topic can you please upload a video on how to take image input like some random application wants our image

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

    nice tutorial

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

    Thank you so much

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

    About how long of someone learning Java would you say should understand this information clearly? Hopefully that made sense

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

    Wait so which part of this is the array? I'm confused

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

    Thank you alex !! from france

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

    THNAKS, you saved mi life.

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

    thanks a lott these videos help, i am actually trying to make an app for parking since i forget to put parking . Can you help me make the app. this is how the app should work -> read the number see if it matches the number i put. -> read the timing till when the parking ticket lasts for and set alarms before the time provided . I cant find any UA-cam channel that will help me in this problem, if you can please find the time to make a video on this. i would be very grateful thankyouuu soo much once again

  • @lilishisa6687
    @lilishisa6687 9 місяців тому +1

    תודה!

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

    Thank you so much...😊🙏
    .
    Just one doubt , Is it possible to search for a particular value,like just one name like "Alex" and the program will print all the corresponding values which we need..?

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

    Hello Alex, I hope you are doing well.I wanna little guide from you..I have understood all the concepts of java but while I am trying for competitive coding I am unable to solve it..can you suggest how to be good at competitive coding

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

    You are awesome thanks

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

    hi, how do you sort arrays from the file? Let's say the length of the address from shortest to longest?

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

    yo Alax can you pls make a vid on maps and hashmaps in java? I really need it and love your videos mate:)

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

    Thank you! You're a lifesaver!

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

    Do you think you could do a "Shortest path algorithm" video?

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

    hi alex

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

    Awesome !
    Can you do a vídeo about OCR?

  • @василийвасильев-й5г

    thanks bra, great video

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

    Bro, have you learned programming language by choosing IT course or you learn by yourself😀😀😀♥️♥️

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

    Hi! Great video! How can I attach each comma separated value to a variable rather than naming the value in the print()?

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

    Do you use "WindowBuilder" plugin for eclipse when making GUI's? If so will you make a tutorial?
    I read that it was easier to use this plugin in making GUI's

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

    How would you separate a txt file into multiple txt files i.e. student2018.txt, student2019txt etc

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

    why does it not read the titles of each column and instead start on line 2?