Java Markup Interface

Source: Internet
Author: User

An interface that does not declare or define a method is called a markup interface (Mark Interface). When a class implements this interface, it does not need to override the method to indicate the functionality that has interface tags. The 3 tag interfaces commonly used in Java are as follows:

1 Serializable

The Java.io.Serializable interface is used to mark whether a class supports serialization. Serialization refers to converting a Java object into a binary byte code. If a class does not implement the interface and the class instance performs a serialization operation, the JVM throws a Notserializableexception exception.

2 cloneable

The Cloneable interface is used to mark whether a class supports cloning. If a class does not implement the interface and the class instance performs a clone operation, the JVM throws a Clonenotsupportedexception exception.

3 randomaccess

The Randomaccess interface is used to mark whether a class supports random access.

Resources

Internal organs Heart--Java Tag interface

In-depth learning of Java serialization

"Java Programmer interview written book" P54-56

Java Markup Interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.