Java – the best way to mark an inherited class as not serializable

If I inherit from a serializable class, but I especially don't want my class to be serializable; What is the best way to strictly prevent serialization?

If in Java io. There is a method in serializable. I may throw an exception, but serializable is empty

Solution

From documentation

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>