ushort 等价物

发布于 2024-08-09 05:39:24 字数 86 浏览 7 评论 0原文

我有一个 C# 应用程序,我正在尝试将其转换为 java。 C# 应用程序有一些 ushort 类型的变量。 java中有类似的东西吗?

谢谢

I have an application in C# that I'm trying to convert to java. The C# app has a few variables that are of type ushort. Is there an equivalent in java?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迷途知返 2024-08-16 05:39:24

就大小而言最接近的等价物是 char,因为 Java 没有无符号类型,但它在 Java 中重载以提供与单个字符相关的附加语义。一般来说,只需选择下一个最大的整数类型(在本例中为 int)。 (您不是唯一一个不过想要它。)

The closest equivalent in terms of size is char, since Java doesn't have unsigned types, but it's overloaded in Java to provide additional semantics related to individual characters. In general, just pick the next largest integral type (int, in this case). (You're not the only one who wants it, though.)

南烟 2024-08-16 05:39:24

As you may be aware, Java has no unsigned numbers. This means you're going to have to go with another solution. It's generally easiest to just use the next larger type in cases like these, such as int (which is simply a 32-bit signed integer).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文