Using the Java.io to read an object from the command line
Hey guys.
In order to practice Java programming (I've just recently started), I created a "Matrix" class. For those who do not know, a matrix is at its basic just a double array.
My problem is in trying to get my main method to read a double array from the command line. For instance, I want the user to write "{{1,2},{1,4}}", and have the application
create a 2X2 array with those numbers.
I tried using Objectinputstream reader = new objectinputstream(System.in), but at run time this line throws an exception and the method goes immediately to the try block.
What IO method/methods should I be using if I want to read a double array a user wrote on the command line?
Thanks!!!
Adam
Re: Using the Java.io to read an object from the command line
Re: Using the Java.io to read an object from the command line
This scanner class doesn't have any method for reading objects like a double array. Is there a similar class that handles that?