I learnt that, Java allows file names to have unicode characters.
How to name a file,
naïve.java
,
using english keyboard?
Is there a notation similar to unicode escape notation(used in java source code) that we can use to name java files with unicode characters?
It seems that you are referring to JLS §7.2 “Host Support for Packages”:
A package name component or class name might contain a character that cannot correctly appear in a host file system's ordinary directory name, such as a Unicode character on a system that allows only ASCII characters in file names. As a convention, the character can be escaped by using, say, the @ character followed by four hexadecimal digits giving the numeric value of the character, as in the \uxxxx escape (§3.3).
Under this convention, the package name:
children.activities.crafts.papierM\u00e2ch\u00e9
which can also be written using full Unicode as:
children.activities.crafts.papierMâché
might be mapped to the directory name:
children/activities/crafts/papierM@00e2ch@00e9
Note that this is described as a convention and only for characters not being supported by the host’s filesystem. So the first obstacle is to find a system without Unicode support in the file system API before you can check whether javac
still adheres to this convention.
So for most systems, if you want to name a file naïve.java
, there’s not only support to name it directly that way, you also have to name it that way as the fallback escaping scheme is not supported by tools designed to run only on systems which don’t need it.
That leads to your other question about how to enter it via the keyboard. Well, that’s system dependent. The most portable solution is:
naïve.java
with the mouse.java
fileAs a general solution, refrain from using every feature, the Java programming language offers…