如何在Java中键入π(pi)?

Math API中是否有字符允许表示字符π?

解决方法

你甚至不需要使用Math API.在 Java代码中,
\u03C0

相当于:

π

你甚至可以在标识符中使用它;这两个是等效的

final String \u03C0 = "\u03C0";
final String π = "π";

(正如规范所说:

A Unicode escape of the form \uxxxx,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.)

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...