fork download
  1. public class Main {
  2. public static void main(String[] args) {
  3. // ANSI escape codes for colored output
  4. String redText = "\u001B[31m"; // Red color code
  5. String blueBackground = "\u001B[44m"; // Blue background color code
  6. String resetColor = "\u001B[0m"; // Reset color code
  7.  
  8. // Print "Hello, World" in red with a blue background
  9. System.out.println(blueBackground + redText + "\n\n Hello, World \n\n" + resetColor);
  10.  
  11.  
  12.  
  13. // Display the color key
  14. System.out.println("\nColor Key:");
  15. System.out.println(redText + "Red Text" + resetColor);
  16. System.out.println(blueBackground + "Blue Background" + resetColor);
  17. }
  18. }
  19.  
Success #stdin #stdout 0.18s 58008KB
stdin
Standard input is empty
stdout


   Hello, World   



Color Key:
Red Text
Blue Background