The error can occur in two places: 1) When you compile or 2) when you run the program.
1) The compiler reads the source code file interpreting the bytes in it as a stream of characters using a
character encoding. If it cannot interprete some byte as a character it replaces it with an "illegal character" symbol which almost always prints out as a question mark. The encoding that the compiler uses depends on the settings of the computer, or it can be set on the command line. Because the character encodings vary from platfrom to platform and user to user, it is more portable to write the source in ASCII and replace non-ASCII characters wtih unicode-escapes. For example you would write "Aveo recibi\u00f3 distinci\u00f3n de Auto." The native2ascii tool that is distributed with the JDK can make this conversion automatically.
2) When you run the program and print a String, the bytes that are printed to the console or file depend on the language settings of the user's system. If the language settings don't support some characters, they are replaced with question marks. On linux you can change the language settings by changing certain environment variables, namely LANG, LC_ALL, or LC_CTYPE. Try for example these commands:
See the manual page of the "locale" command for more information on the environment variables and ways to list available locales.
But when I run the same program from command prompt I get a "<" error.
What is a "<" error?