Wait a gosh-darned second. so this was an interview question for C/C++ all along and then the explanation is asked for in a Java-oriented site in the actual New to Java forum...

Sorry but in the context of this post in this forum, gotoxy() is NOT an acceptable answer. If you ask here you ask how to do it using Java.