Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-05-31 17:49:15 09月21日 Update

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.

Tags: Concept security article information content sequence sequence number type compilation proper obsolete not used function instance idea pointer interface new knowledge method more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Shulou Tech Info Linux vpn