I have some trouble understanding piping on unix. I know it is that you give the output of a class to another class as input. For my programming assignment, I have to create an array of 52 cards in Deck (main driver) class. It prints a string version of it onto stdout. Shuffle (main driver) class reads a string version of a deck of cards from stdin and shuffles the deck, and writes the string version to stdout. However, when I am writing Shuffle class, should I use object reference to the deck then (keyword: new)? Here is part of my Shuffle class:
I am very confused because it's like if you use object reference, then what's the point of piping? If you use piping, then why use object reference? But w/o OR, I can't write a method. Thank you for any clarification.
I'm not sure where the concept of pipes comes into play here. Pipes are used to tie two or more processes together on the Unix level, yet you mention only a single process (this Java program) - am I missing something?
What the code needs is that you fill the "deck" array with actual Cards objects (and yes - that involves calling "new Cards(...)" 52 times). "new Cards" only creates the array that will hold the Cards objects, not the objects themselves.