How to Clear a Screen and Put a New One in Java

Java is a widely used, object-oriented programming language developed by Sun Microsystems. The Java platform is a highly flexible and portable language, making it one of the most abundantly used languages in the world. Text output that is sent to the visual console in Java cannot be directly cleared without first implementing a complex and specialized interface. The console, however, can be filled with blank data to make it appear empty, creating a fresh screen that can accept new text output.

Instructions

    • 1

      Enter the following code at the beginning of your Java program to import the required components:

      import java.lang.*;

    • 2

      Enter the following code into the Main method of your Java application:

      public void ClearConsole()
      {
      }

    • 3

      Enter the following code between the ClearConsole brackets to create a loop:

      for (int i = 0; i < 50; i++)
      System.out.println("\n");

    • 4

      Enter the following code within your program whenever you want to clear the console and start with a blank screen:

      new Main().ClearConsole();

Related Searches:

References

Resources

Comments

Related Ads

Featured