大网数据广告活动
Windows 系统接口

Translating to Java from C++

· 52CE 我爱测

Using the C++ programming language, developers can directly access the memory that stores a particular variable. Memory pointers provide this direct access. In Java, pointers are handled for you.

Using the C++ programming language, developers can directly access the memory that stores a particular variable. Memory pointers provide this direct access. In Java, pointers are handled for you.

In Java, struct, union, and typedef composite data types are handled exclusively through the use of classes. For example, the C++ VARIANT data type maps to com.ms.com.Variant in Java.

In C++, strings are an array of characters. In Java, strings are objects. Methods that act on strings treat the string as a complete object.

COM methods return a value known as a HRESULT, which is a 32-bit error code. The Java support for Microsoft Internet Explorer defines a class, com.ms.com.ComException, which wraps the HRESULT error code.

Java does not support unsigned data types except for char, which is a 16-bit unsigned integer. Methods that accept or return other unsigned data types cannot be used from Java.

Java does not support multidimensional arrays. Methods that accept or return multidimensional arrays are not available from Java.

Boolean values in Java cannot be cast to 0 and 1.

Related topics

Translating to Java

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。