I have the following statements inside my class:
String myName = "Joe";
System.out.println("My name is " +myName);
I need the value on the variable myName
to be printed as italic text.
I have the following statements inside my class:
String myName = "Joe";
System.out.println("My name is " +myName);
I need the value on the variable myName
to be printed as italic text.
Try:
System.out.println("\033[3mText goes here\033[0m");
Which will output italic text if your console supports it. You can use [1m
for bold, etc. Play around with the different values of [
nm
.
Here is an example of how to do that:
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
public class Foo
{
public static void main(String[] args) throws IOException
{
PrintWriter out = new PrintWriter(new FileWriter("myFile.html"));
out.println("<u><i>my output</i></u>");
out.flush();
out.close();
}
}
© 2022 - 2024 — McMap. All rights reserved.