Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use transient in java

Shulou Source: shulou.com Published: 2022-05-31 10:53:33 09月23日 Update

Most people do not understand the knowledge points of this article "how to use transient in java", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use transient in java" article.

1. Transient prevents serialization of variables modified with this keyword. When an object is deserialized, the value of the variable modified by transient is not persisted and recovered.

2. Transient can only modify variables, not classes and methods.

Example

Public Catalog TreeCatalog (String catalogId) {Catalog catalogNode = findById (catalogId). Get (); / query the current node List catalogList = findChild (catalogId); / / query all the children of the node for (Catalog child: catalogList) {Catalog catalog = TreeCatalog (child.getCatalog_id ()); catalogNode.getChildren (). Add (catalog);} return catalogNode } the above is about the content of this article on "how to use transient in java". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Content nodes variables sequences articles knowledge articles queries values keys keywords most instances objects that is methods more steps knowledge points industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Tech Info Huawei Docker Linux