Read text file line by line - Java Quick Tip

preview_player
Показать описание
Read file line by line - Java Quick Tip

Please leave a comment with feedback.

Any Questions?
Feel free to leave me a comment, I will answer you as quick as i can.

Subscribe to me:

Follow me on Twitter:
Рекомендации по теме
Комментарии
Автор

->

a one line solution to reading a file line by line
I use this code in a card flip game to create an ArrayList of cards for the deck (its based on thomas and friends thus the name of the file)

public void buildTheDeckAndShuffleIt() throws IOException {

// builds the deck taking input from the file thomas.crd one card value per line
// this will create as many cards as the file holds
-> deck.add(new Card(cardValue)));

//shuffle the deck
Collections.shuffle(deck);
}

I just thought i'd share this as ur video was the first one i watched that got this program working and then I continued research. Thank you for ur time and effort producing good programming tips.

brianburnett
Автор

When I try to duplicate this code I get a compile error, "The constructor BufferedReader(FileReader) is undefined.  How can I get this code to compile?

tpratt