Language: Java

static double dis(double r, double g, double b) {
        return Math.sqrt( r*r+ g*g+ b*b);
    }
    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:1: 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:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                          ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                   ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                              ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                     ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                             ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                         ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                               ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                       ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                    ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                         ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                 ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                             ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                   ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                          ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                       ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                            ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                       ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                 ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                         ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                   ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                             ^
Main.java:5: error: illegal character: '\u201c'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                     ^
Main.java:5: error: illegal character: '\u201d'
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                              ^
Main.java:5: error: not a statement
        String [] names ={?000black?,?001blue?,?010lime?,?011aqua?,?100red?,?101fuchsia?,?110yellow?,?111white?};     
                                                                                                         ^
Main.java:7: error: class, interface, enum, or record expected
        while(sc.hasNext()){
        ^
Main.java:9: error: class, interface, enum, or record expected
            if(str.equals(?0?)) break;
            ^
Main.java:9: error: illegal character: '\u201c'
            if(str.equals(?0?)) break;
                          ^
Main.java:9: error: illegal character: '\u201d'
            if(str.equals(?0?)) break;
                            ^
Main.java:13: error: illegal character: '\u201c'
            String ans = ??;
                         ^
Main.java:13: error: illegal character: '\u201d'
            String ans = ??;
                          ^
Main.java:15: error: class, interface, enum, or record expected
            for(String name: names) {
            ^
Main.java:16: error: illegal character: '\u2018'
                int r = (name.charAt(0)-?0?) * 255;
                                        ^
Main.java:16: error: illegal character: '\u2019'
                int r = (name.charAt(0)-?0?) * 255;
                                          ^
Main.java:17: error: illegal character: '\u2018'
                int g = (name.charAt(1)-?0?) * 255;
                                        ^
Main.java:17: error: illegal character: '\u2019'
                int g = (name.charAt(1)-?0?) * 255;
                                          ^
Main.java:18: error: illegal character: '\u2018'
                int b = (name.charAt(2)-?0?) * 255;
                                        ^
Main.java:18: error: illegal character: '\u2019'
                int b = (name.charAt(2)-?0?) * 255;
                                          ^
Main.java:20: error: class, interface, enum, or record expected
                if(d>min){
                ^
Main.java:22: error: class, interface, enum, or record expected
                    ans=name;
                    ^
Main.java:23: error: class, interface, enum, or record expected
                }
                ^
Main.java:26: error: class, interface, enum, or record expected
        }
        ^
42 errors