Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of @ SuppressWarnings in java and how to use it

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail "what is the concept of @ SuppressWarnings in java and how to use it". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "what is the concept of @ SuppressWarnings in java and how to use it" can help you solve your doubts.

Concept

1. Indicates suppression warning. The purpose of this note is to ignore the warning message.

2. The function is to tell the compiler to ignore the specified warning and not to have a warning message after the compilation is completed.

Method

Deprecation, ignore out of date

Rawtypes, ignoring type safety

Unused, ignore do not use

Unchecked, ignore the security check

Null, ignore null

All, ignore all

Example

/ / # 3 suppression warning / / serial: implements the serial number interface, but does not produce the serial number @ SuppressWarnings ("serial") class Parent1_4 implements java.io.Serializable {/ / null: null pointer @ SuppressWarnings ("null") public void init () {/ / rawtypes: type safe, without generic / / unused: do not use @ SuppressWarnings ({"rawtypes", "unused"}) List list = new ArrayList (); String str = null Str.toString ();}} read here, this article "what is the concept of @ SuppressWarnings in java and how to use it" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report