1
S = "hello"

System.out.print(s)

I've also tried:

System.out.println("\033[4mhello\033[0m");

This prints out [4mhello[0m

I'm stuck on how to print hello underlined. I search everywhere but got no luck.

mypetlion
  • 2,415
  • 5
  • 18
  • 22
Hiep Huynh
  • 11
  • 2

1 Answers1

1

use ANSI codes.

like:

public class Main {
    public static void main(String[] args) {
        System.out.println("\033[4;2m" + "Hello World");
    }
}

note:

ANSI-coded strings wont work in windows terminal.

Debil.exe
  • 11
  • 1
  • 3