Today feels like a sleepy day, I don't know why that is. It just feels that way. I wish I could figure out why life happens the way it does. But I don't understand how anything goes about in this life. If I could understand one thought in life...I think I'd like it to be able to grasp why we are here on this Earth. Is it because the aliens want us to become something better than we are? I mean they're the ones in charge right? I think they are.
Sometimes when you're writing a program in Java you want to clear the screen. That is to remove all text from the screen.
Here's how we would do this in Java:
private void clearScreen() {
try {
if (System.getProperty("os.name").contains("Windows")) {
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
} else {
new ProcessBuilder("clear").inheritIO().start().waitFor();
}
} catch (IOException | InterruptedException ex) {
ex.printStackTrace();
}
}
This takes into account both windows and non windows. cls for Windows, clear for linux etc.
Comments
Post a Comment