2

I want achieve that to make a basic game

Is there any way to print a character in console in a x,y coordinate like gotoxy function in conio library of C language?

Unknow
  • 47
  • 5

1 Answers1

0

Just as with C, Java provides no built-in way to do full-screen terminal output.

And, as with C, you have two main options:

  • You could assume that the terminal understands ANSI escape codes, and output those directly.  That's quick-and-dirty; it doesn't require any dependencies, and the basics can be done fairly easily.  But it's not very maintainable; anything more sophisticated gets very fiddly — and, more importantly, it's likely to fail on other terminal types.

  • Or you could use a library which does all the hard work.  These questions ask about that, and have several answers.

gidds
  • 16,558
  • 2
  • 19
  • 26