public class Main {
public static void main
( String [ ] args
) { // ANSI escape codes for colored output
String redText
= "\u 001B[31m" ; // Red color code String blueBackground
= "\u 001B[44m" ; // Blue background color code String resetColor
= "\u 001B[0m" ; // Reset color code
// Print "Hello, World" in red with a blue background
System .
out .
println ( blueBackground
+ redText
+ "\n \n Hello, World \n \n " + resetColor
) ;
// Print additional details
System .
out .
println ( "This is a simple Java program running on an online compiler!" ) ; System .
out .
println ( "It demonstrates how to use ANSI escape codes for colored text output in the console." ) ;
// Display the color key
System .
out .
println ( "\n Color Key:" ) ; System .
out .
println ( redText
+ "Red Text" + resetColor
) ; System .
out .
println ( blueBackground
+ "Blue Background" + resetColor
) ; }
}
cHVibGljIGNsYXNzIE1haW4gewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIC8vIEFOU0kgZXNjYXBlIGNvZGVzIGZvciBjb2xvcmVkIG91dHB1dAogICAgICAgIFN0cmluZyByZWRUZXh0ID0gIlx1MDAxQlszMW0iOyAvLyBSZWQgY29sb3IgY29kZQogICAgICAgIFN0cmluZyBibHVlQmFja2dyb3VuZCA9ICJcdTAwMUJbNDRtIjsgLy8gQmx1ZSBiYWNrZ3JvdW5kIGNvbG9yIGNvZGUKICAgICAgICBTdHJpbmcgcmVzZXRDb2xvciA9ICJcdTAwMUJbMG0iOyAvLyBSZXNldCBjb2xvciBjb2RlCgogICAgICAgIC8vIFByaW50ICJIZWxsbywgV29ybGQiIGluIHJlZCB3aXRoIGEgYmx1ZSBiYWNrZ3JvdW5kCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGJsdWVCYWNrZ3JvdW5kICsgcmVkVGV4dCArICJcblxuICAgSGVsbG8sIFdvcmxkICAgXG5cbiIgKyByZXNldENvbG9yKTsKICAgICAgICAKICAgICAgICAvLyBQcmludCBhZGRpdGlvbmFsIGRldGFpbHMKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIlRoaXMgaXMgYSBzaW1wbGU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