+ 9
Why This java code makes an error ?
public class Program { public static void main(String[] args) { String[] arrSym = {"!",",","#","@","^",")",":","(","?","-","_","&","
quot;,"₩","¥","£","€","`","<",">","¿","¡",";","《","》","☆","▪","¤","♧","♢","♡","♤","■","□","●","○","•","°","]","[","}","{","<",">","|","~","+","×","÷","=","%","/","*"}; System.out.println(arrSym[5]); } }2 Antworten
+ 7
There are some inscrutable characters for compilator. I deleted all them and got this code.
public class Program
{
public static void main(String[] args) {
String[] arrSym = {"!",",","#","@","^",")",":","(","?","-","_","&","quot;,"`","<",">","¿","¡",";","《","》","]","[","}","{","<",">","|","~","+","×","÷","=","%","/","*"};
System.out.println(arrSym[5]);
}
}
+ 5
Most probably the reason is that you are going to try non-ascii chars.
Add the following snippet at the top of main then there should be no errors.
OutputStreamWriter w = new OutputStreamWriter(System.out,"unicode");
w.write("😆😅");
w.flush();