Language: Java

import java.util.*;

static double dis(double r, double g, double b) {
        return Math.sqrt( r*r+ g*g+ b*b);
    }
public class Main {

    public static void main(String[] args) throws Exception {
        String [] names ={“000black”,“001blue”,“010lime”,“011aqua”,“100red”,“101fuchsia”,“110yellow”,“111white”};     
        Scanner sc = new Scanner(System.in);   
        while(sc.hasNext()){
            String str = sc.nextLine();
            if(str.equals(“0”)) break;
            int r0 = Integer.parseInt(str.substring(1,3), 16);
            int g0 = Integer.parseInt(str.substring(3,5), 16);
            int b0 = Integer.parseInt(str.substring(5,7), 16);
            String ans = “”;
            double min = 256.0;
            for(String name: names) {
                int r = (name.charAt(0)-‘0’) * 255;
                int g = (name.charAt(1)-‘0’) * 255;
                int b = (name.charAt(2)-‘0’) * 255;
                double d = dis(r-r0, g - g0, b - b0);
                if(d>min){
                    min=d;
                    ans=name;
                }
            }
            System.out.println(ans.substring(3));
        }
    }
}


Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
static double dis(double r, double g, double b) {
       ^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                          ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                   ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                              ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                     ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                             ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                         ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                               ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                       ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                    ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                         ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                 ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                             ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                   ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                          ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                       ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                            ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                       ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                 ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                         ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                   ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                             ^
Main.java:9: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                     ^
Main.java:9: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                              ^
Main.java:9: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                         ^
Main.java:11: error: illegal start of type
        while(sc.hasNext()){
        ^
Main.java:11: error: <identifier> expected
        while(sc.hasNext()){
                        ^
Main.java:11: error: ';' expected
        while(sc.hasNext()){
                          ^
Main.java:13: error: illegal character: '\u201c'
            if(str.equals(?0?)) break;
                          ^
Main.java:13: error: illegal character: '\u201d'
            if(str.equals(?0?)) break;
                            ^
Main.java:17: error: illegal character: '\u201c'
            String ans = ??;
                         ^
Main.java:17: error: illegal character: '\u201d'
            String ans = ??;
                          ^
Main.java:20: error: illegal character: '\u2018'
                int r = (name.charAt(0)-?0?) * 255;
                                        ^
Main.java:20: error: illegal character: '\u2019'
                int r = (name.charAt(0)-?0?) * 255;
                                          ^
Main.java:21: error: illegal character: '\u2018'
                int g = (name.charAt(1)-?0?) * 255;
                                        ^
Main.java:21: error: illegal character: '\u2019'
                int g = (name.charAt(1)-?0?) * 255;
                                          ^
Main.java:22: error: illegal character: '\u2018'
                int b = (name.charAt(2)-?0?) * 255;
                                        ^
Main.java:22: error: illegal character: '\u2019'
                int b = (name.charAt(2)-?0?) * 255;
                                          ^
Main.java:32: error: class, interface, enum, or record expected
}
^
39 errors