How do I type π (PI) in Java?

Is there a character in the math API that allows the character π to be represented?

Solution

You don't even need to use the math API In the Java source code,

\u03C0

amount to:

π

You can even use it in identifiers; The two are equivalent

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

(as stated in the specification:

see http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.2. )

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>