Home > Java > javaTutorial > How to use transient in java

How to use transient in java

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-04-30 09:19:12
forward
1450 people have browsed it

1. Transient prevents variables modified with this keyword from being serialized. When the object is deserialized, the variable value modified by transient will not be persisted and restored.

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

Example

public Catalog TreeCatalog(String catalogId) {
 
    Catalog catalogNode = findById(catalogId).get(); // 查询当前节点
 
    List<Catalog> catalogList = findChild(catalogId); //查询该节点的所有子节点
 
    for (Catalog child : catalogList) {
 
        Catalog catalog = TreeCatalog(child.getCatalog_id());
 
        catalogNode.getChildren().add(catalog);
 
    }
 
    return catalogNode;
 
}
Copy after login

The above is the detailed content of How to use transient in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template