Question: I print hindi characters as string in java and I'm getting an error. I save the java file in notepad uing UTF-8.

```
public class MainClass {
    public static void main(String args[]) throws Exception {
        String s = "साहिलसाहिल";

        System.out.print(s);
    }
}

```

After compilation, I get 2 errors of illegal character. Why so?

Answer: 
You have to specify the appropriate encoding :

```
javac -encoding utf8 MainClass.java

```
try it with

`java -Dfile.encoding=UTF8 MainClass.java`