How to Clear the Screen in Java
Open the IDE., Copy and paste the following code: class Clear { public static void main(String[] args) { System.out.print("\f"); System.out.print("Hello there !, Run the program., Understand what the program does.
Step-by-Step Guide
-
Step 1: Open the IDE.
Open your IDE of choice, or use write and then run the code through the Command Prompt. ,"); } } , The output will be Hello there !.
Also it will clear the console before typing out the message., Once you understand how it works, you can use the same method in other contexts more easily.
First it inserts a new form-feed due to escape sequence "\f"
thereby clearing the screen.
Then, it prints out the message :
Hello there ! -
Step 2: Copy and paste the following code: class Clear { public static void main(String[] args) { System.out.print("\f"); System.out.print("Hello there !
-
Step 3: Run the program.
-
Step 4: Understand what the program does.
Detailed Guide
Open your IDE of choice, or use write and then run the code through the Command Prompt. ,"); } } , The output will be Hello there !.
Also it will clear the console before typing out the message., Once you understand how it works, you can use the same method in other contexts more easily.
First it inserts a new form-feed due to escape sequence "\f"
thereby clearing the screen.
Then, it prints out the message :
Hello there !
About the Author
Joan Nguyen
Enthusiastic about teaching pet care techniques through clear, step-by-step guides.
Rate This Guide
How helpful was this guide? Click to rate: