Storing System.out to a variable
When accepting input from the console, you can use a Scanner class as follows:
Scanner console = new Scanner(System.in);
I was wondering if there was some way to do the same thing with an output like this:
ClassX varName = new ClassX(System.out);
So then I could simply type:
I'm doing a lot of command-line exercises and I'm looking for some way of shortening some of the code I have to type, and it would be nice not to have to type System.out every time I need it.
I could just use JOptionPane, but I'd rather see if there's a way to do this instead.