In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the class Logon is in JAVA. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The class Logon is a class that records login information, including user names and passwords. First it implements the interface Serializable, which indicates that it can be serialized. Then ObjectOutputStream o = newObjectOutputStream (newFileOutputStream ("Logon.out")) in the main method; create a new object output stream that wraps a file stream, indicating that the destination of the object serialization is the file Logon.out. Then start writing with the method writeObject. When you want to restore, it is also very simple ObjectInputStream in = newObjectInputStream (newFileInputStream ("Logon.out")); create a new object input stream with the file stream Logon.out as the parameter, and then call the readObject method.
It is important to note that the magic of object serialization is that it establishes an object network that contains all the references held in the objects to be serialized and writes them to a file, and even more wonderfully, if you serialize several objects at a time, the same content in them will be shared. This is indeed a very good mechanism. It can be used to make deep copies.
The keyword transient here means that the current content will not be serialized, such as the password in the example, which needs to be kept secret, so it is not written to the file.
This is the end of this article on "what is Logon in JAVA". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.