Home >Java >javaTutorial >Should You Use Sun's Proprietary Java Classes?
Using Sun's Proprietary Java Classes: A Question of Practice
It is a widely held belief that relying on Sun's proprietary Java classes is an unwise practice. While the compiler may issue warnings, this article delves deeper into the fundamental reasons why it is generally advisable to refrain from using these classes.
Reason 1: Internal APIs
Sun's proprietary classes are categorized as internal APIs. This implies that they are not part of the public Java API and are subject to change in ways that may not be documented or supported. As such, they can introduce instability and potential compatibility issues into your codebase.
Reason 2: Platform Dependency
These classes are tied to a specific JRE/JDK (in this case, Sun's own implementation). This limits the portability of your programs, as they may not function correctly or consistently across different Java platforms.
Recommendation
To ensure the stability, maintainability, and portability of your Java code, it is highly recommended to avoid using Sun's proprietary classes. Instead, prioritize the use of public, documented, and specified classes that are part of the standard Java API.
The above is the detailed content of Should You Use Sun's Proprietary Java Classes?. For more information, please follow other related articles on the PHP Chinese website!