Java - what should be basic stuff is giving errors every line : <p>The objective is to receive in a string of letters and return a string of 1's and 0's that correspond for each. So "100000" for 'a' for example. But it refuses to compile, and I'm unsure what is wrong. The errors are popping up practically every line. I am not sure if I broke some fundamental rule of Java or why it is upset with me. Any direction or tips would be swell. I apologize for the large code blocks, once you hit the series of else if in my code, after the 2nd one they're all the same.</p>

<p>Here is my code:</p>

<pre><code>package com.google.challenges; 

public class Answer {   

public static String answer(String plaintext) { 
    String[] braille = new String[50];
    String answer = "";
    char j = 'a';

    for(int i=0; i&lt;plaintext.length();i++){
        j = plaintext.charAt(i);
        j = switch(j);
        braille[i] = j;
    }//close for

    for(int i=0; i&lt;plaintext.length(); i++){
        answer = answer+braille[i];
    }
    return answer;

} //close answer
public static String switch (char x)
{
    String a = "100000";
    String b = "110000";
    String c = "100100";
    String d = "100110";
    String e = "100010";
    String f = "110100";
    String g = "110110";
    String h = "110010";
    String i = "010100";
    String j = "010110";
    String k = "101000";
    String l = "111000";
    String m = "101100";
    String n = "101110";
    String o = "101010";
    String p = "111100";
    String q = "111110";
    String r = "111010";
    String s = "011100";
    String t = "011110";
    String u = "101001";
    String v = "111001";
    String w = "010111";
    String x = "101101";
    String y = "101111";
    String z = "101011";
    String cap = "000001";
    String space = "000000";

    if (x == 'a' || x == 'A'){
        if(x=='a'){
            return a;
        }
        return cap + a;
    }
    else if (x == 'b' || x == 'B'){
        if(x=='b')
        {
            return b;
        }
        return cap + b;
    }
    else if (x == 'c' || x == 'C'){
        if(x=='c'){
            return c;
        }
        return cap + c;
    }
    else if (x == 'd' || x == 'D'){
        if(x=='d'){
            return d;
        }
        return cap + d;
    }
    else if (x == 'e' || x == 'E'){
        if(x=='e'){
            return e;
        }
        return cap + e;
    }
    else if (x == 'f' || x == 'F'){
        if(x=='f'){
            return f;
        }
        return cap + f;
    }
    else if (x == 'g' || x == 'G'){
        if(x=='g'){
            return g;
        }
        return cap + g;
    }
    else if (x == 'h' || x == 'H'){
        if(x=='h'){
            return h;
        }
        return cap + h;
    }
    else if (x == 'i' || x == 'I'){
        if(x=='i'){
            return i;
        }
        return cap + i;
    }
    else if (x == 'j' || x == 'J'){
        if(x=='j'){
            return j;
        }
        return cap + j;
    }
    else if (x == 'k' || x == 'K'){
        if(x=='k'){
            return k;
        }
        return cap + k;
    }
    else if (x == 'l' || x == 'L'){
        if(x=='l'){
            return l;
        }
        return cap + l;
    }
    else if (x == 'm' || x == 'M'){
        if(x=='m'){
            return m;
        }
        return cap + m;
    }
    else if (x == 'n' || x == 'N'){
        if(x=='n'){
            return n;
        }
        return cap + n;
    }
    else if (x == 'o' || x == 'O'){
        if(x=='o'){
            return o;
        }
        return cap + o;
    }
    else if (x == 'p' || x == 'P'){
        if(x=='p'){
            return p;
        }
        return cap + p;
    }
    else if (x == 'q' || x == 'Q'){
        if(x=='q'){
            return q;
        }
        return cap + q;
    }
    else if (x == 'r' || x == 'R'){
        if(x=='r'){
            return r;
        }
        return cap + r;
    }
    else if (x == 's' || x == 'S'){
        if(x=='s'){
            return s;
        }
        return cap + s;
    }
    else if (x == 't' || x == 'T'){
        if(x=='t'){
            return t;
        }
        return cap + t;
    }
    else if (x == 'u' || x == 'U'){
        if(x=='u'){
            return u;
        }
        return cap + u;
    }
    else if (x == 'v' || x == 'V'){
        if(x=='v'){
            return v;
        }
        return cap + v;
    }
    else if (x == 'w' || x == 'W'){
        if(x=='w'){
            return w;
        }
        return cap + w;
    }
    else if (x == 'x' || x == 'X'){
        if(x=='x'){
            return x;
        }
        return cap + x;
    }
    else if (x == 'y' || x == 'Y'){
        if(x=='y'){
            return y;
        }
        return cap + y;
    }
    else if (x == 'z' || x == 'Z'){
        if(x=='z'){
            return z;
        }
        return cap + z;
    }
    else{
        return space;
    }
}//close switch
}//close class
</code></pre>

<p>And here are my errors:</p>

<pre><code>/Answer.java:12: error: illegal start of expression
j = switch(j);
^
/Answer.java:12: error: not a statement
j = switch(j);
^
/Answer.java:22: error: &lt;identifier&gt; expected
public static String switch (char x)
^
/Answer.java:22: error: illegal start of type
public static String switch (char x)
^
/Answer.java:22: error: &lt;identifier&gt; expected
public static String switch (char x)
^
/Answer.java:22: error: ';' expected
public static String switch (char x)
^
/Answer.java:22: error: illegal start of type
public static String switch (char x)
^
/Answer.java:22: error: &lt;identifier&gt; expected
public static String switch (char x)
^
/Answer.java:23: error: ';' expected
{
^
/Answer.java:24: error: &lt;identifier&gt; expected
String a = "100000";
^
/Answer.java:53: error: illegal start of type
if (x == 'a' || x == 'A'){
^
/Answer.java:53: error: &lt;identifier&gt; expected
if (x == 'a' || x == 'A'){
^
/Answer.java:53: error: ';' expected
if (x == 'a' || x == 'A'){
^
/Answer.java:53: error: illegal start of type
if (x == 'a' || x == 'A'){
^
/Answer.java:53: error: ';' expected
if (x == 'a' || x == 'A'){
^
/Answer.java:59: error: illegal start of type
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: ';' expected
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: illegal start of type
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: ';' expected
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: &lt;identifier&gt; expected
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: illegal start of type
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: &lt;identifier&gt; expected
else if (x == 'b' || x == 'B'){
^
/Answer.java:59: error: ';' expected
else if (x == 'b' || x == 'B'){
^
/Answer.java:60: error: illegal start of type
if(x=='b')
^
/Answer.java:60: error: &lt;identifier&gt; expected
if(x=='b')
^
/Answer.java:60: error: ';' expected
if(x=='b')
^
/Answer.java:60: error: illegal start of type
if(x=='b')
^
/Answer.java:60: error: &lt;identifier&gt; expected
if(x=='b')
^
/Answer.java:60: error: ';' expected
if(x=='b')
^
/Answer.java:64: error: illegal start of type
return cap + b;
^
/Answer.java:64: error: ';' expected
return cap + b;
^
/Answer.java:64: error: illegal start of type
return cap + b;
^
/Answer.java:66: error: class, interface, or enum expected
else if (x == 'c' || x == 'C'){
^
/Answer.java:69: error: class, interface, or enum expected
}
^
/Answer.java:71: error: class, interface, or enum expected
}
^
/Answer.java:75: error: class, interface, or enum expected
}
^
/Answer.java:77: error: class, interface, or enum expected
}
^
/Answer.java:81: error: class, interface, or enum expected
}
^
/Answer.java:83: error: class, interface, or enum expected
}
^
/Answer.java:87: error: class, interface, or enum expected
}
^
/Answer.java:89: error: class, interface, or enum expected
}
^
</code></pre>

<p>The error continues on just like the line 89 error for another 100 lines.</p>
