Hiep Huynh
Hiep Huynh

Reputation: 11

How to print an underlined string in java with eclipse

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.

Upvotes: 1

Views: 1614

Answers (1)

Debil.exe
Debil.exe

Reputation: 21

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.

Upvotes: 1

Related Questions