tags:

views:

58

answers:

2

Working on Java in a Windows-run computer lab.

System.out.print ("Hello!");
System.out.print ("\b");

Prints

Hello![]

Where [] is a box, so as to signify a character the font doesn't support, or has an invalid ASCII value or something.

This is something pretty primitive, and comes in handy to make fancy looking terminal applications, so please help me out :)

+1  A: 

This problem indeed occurs in at least Eclipse's console, but certainly not in Windows command console.

Also see this related topic: How to get backspace \b to work in Eclipse’s console?

BalusC
A: 

I don't know about Eclipse's failures (god knows I've pulled enough hair out trying to fix issues my coworker gets using Eclipse), but could you manage with using the [home] character?

System.out.print("Hello!" + (char)13);
System.out.print("      ");
System.out.print("Hello");

It's a kludge compared to \b for your purpose, but if the output you're using doesn't work with one control character, try another! :)

Brian S
Thanks, sorry about the late reply, but this works pretty nicely. Yes, could be more concise, but what the hell.
Angad