您现在的位置是:课程教程文章

java中transient是什么

2023-12-13 22:53课程教程文章 人已围观

1、transient防止用这个关键词修饰的变量序列化。当对象被反序列化时,被 transient 修饰的变量值不会被持久化和恢复。

2、transient 只能修饰变量,不能修饰类和方法。

实例

publicCatalogTreeCatalog(StringcatalogId){

CatalogcatalogNode=findById(catalogId).get();//查询当前节点

List<Catalog>catalogList=findChild(catalogId);//查询该节点的所有子节点

for(Catalogchild:catalogList){

Catalogcatalog=TreeCatalog(child.getCatalog_id());

catalogNode.getChildren().add(catalog);

}

returncatalogNode;

}

以上就是java中transient的介绍,希望对大家有所帮助。更多Java学习指路:Java基础

课程教程:java中transient是什么

上一篇:java阻塞队列的两种操作

下一篇:没有了

站点信息

  • 文章统计篇文章