-2

I had a question that may sound dumb to many, but I can't stop to post it here as found nothing there on the Internet.

Why does java doesn't have clrscr sort of function that we use in C?

If I created a java concole application that iterates over and over based on user input and then if I want to provide the user an option to clear the screen, then why its not supported in java.

I know there are some ways like this and this.

Is it something related to Java being OOP (I highly doubt but don't have a concrete answer).

Community
  • 1
  • 1
Abubakkar
  • 15,488
  • 8
  • 55
  • 83
  • in real world clrscr is not really wanted. If you need create such app, consider using Swing as GUI - its quite easy – JIV Jun 24 '13 at 06:29

2 Answers2

1

OOP has nothing to do with it. It's more clrscr is more a function of the environment the Java is running in than Java itself, and so it is not in Java's scope.

Or to put it another way: since Java is cross platform and can be run without a console, the meaning of clrscr has to change depending on how the app is run and on what platform.

John3136
  • 28,809
  • 4
  • 51
  • 69
0

I believe it does not exist because of portability issues. Even in C, clrscr() is not really portable - not all platforms support it.

But Java was designed to be write/compile once, run anywhere. And this function does not quite fit into this agenda.

Community
  • 1
  • 1
mvp
  • 111,019
  • 13
  • 122
  • 148