Ask coding questions

← Back to all posts
In repil how do you clear the screen when using java?
screwlosse (1)

I know that you can use System.out.print("\f"); to clear a screen when using other java writing applications but it doesn't work on repil

Comments
hotnewtop
XavierDD (95)

One way is to use this code.

        System.out.print("\033[H\033[2J");  
        System.out.flush();

Please Upvote my comment if this is helpful

theangryepicbanana (1699)

@XavierDD actually do \033[0;0H not \033[H

mat1 (4456)

@theangryepicbanana 0;0 are the default arguments and do not need to be specified.

PAULHANNA (1)

This works with Java code in a REPL.
@XavierDD

XavierDD (95)

@PAULHANNA , thanks. Wasn't expecting for people to look at older stuff on here.