微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在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.)

原文地址:https://www.jb51.cc/java/126230.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐