import java.util.*;
import java.io.*;
class TreeSetPro
{
public static void main(String $[] )throws IOException
{
TreeSet<String> alpha=new TreeSet<String>();
alpha.add("apple");
alpha.add("Apple");
alpha.add("Ab");
alpha.add("applet");
System.out.println(alpha);
String osname = System.getProperty("os.name");
if (osname.contains("Windows"))
{
Runtime.getRuntime().exec("cls"); //java.io.IOException: Cannot
run program "cls"
}
else
{
Runtime.getRuntime().exec("clear"); //java.io.IOException:
Cannot run program "clear"
}
}
}
I went through nearly all of the post related to clearing the console in java but none of them worked for me. I am using windows 8.1.
How am I supposed to clear the console??