I want to save all the text on the terminal as a output on a text file. For the output there can be a function to be used instead of System.out.println()
class OutSave
{
String output;
public static void main()
{
output="";
print("Print this");
print("And save this");
}
public static print(String p)
{
output=output+"\n"+p;
System.out.println(p);
}
}
Something like this but I cannot figure this out for the inputs supplied by the user.
Thanks in Advance