Math API中是否有字符允许表示字符π?
解决方法
你甚至不需要使用Math API.在
Java源代码中,
\u03C0
相当于:
π
你甚至可以在标识符中使用它;这两个是等效的
final String \u03C0 = "\u03C0"; final String π = "π";
(正如规范所说:
A Unicode escape of the form
\u
xxxx,where xxxx is a hexadecimal value,represents the UTF-16 code unit whose encoding is xxxx. This translation step allows any program to be expressed using only ASCII characters.
见http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.2.)