To get a class serialized it's requires to implement Serializable interface, in the same way to achieve some other functionality its advised to implement an interface like multihtreading. Interface deosnt have only abstract method then why they need to be implemented or why they are required to get certain behavior.
-
4see http://javaj2eetutorial.com/java/what-is-a-java-marker-interface/ – Paolo Falabella Aug 19 '14 at 08:24
-
4Welcome to Stackoverflow. Unfortunately, your question is somewhat cryptic and does not state a clear problem, nor shows the effort you put into answering your own question. Please respect that when asking again. – SirRichie Aug 19 '14 at 08:27
-
2Hi, please show us what you have tried, the relevant code and the **specific** issues you are having. Read up on [how to write a Short, Self Contained, Correct Example](http://sscce.org/) and have a look at the [help centre](http://stackoverflow.com/help) on here. Then [edit](http://stackoverflow.com/posts/25378709/edit) your question and give all the necessary details. – RossC Aug 19 '14 at 08:30
-
possible duplicate of [marker interface](http://stackoverflow.com/questions/4540820/marker-interface) – Konstantin V. Salikhov Aug 19 '14 at 11:58
2 Answers
The documentation of Serializable
gives part of the answer: "The serialization interface has no methods or fields and serves only to identify the semantics of being serializable".
Even though there are no methods defined, you identify the class as being something you want to serialize. Same thing for other "flagging" / marker interfaces. It is to make sure that you do not accidentally do things you did not want to - as it is the spirit of strongly typed languages.

- 1,176
- 9
- 14
An interface which does not have any method in it, is said to be Marker Interface. Serializable is marker interface.
Purpose of marker interface is to mark only, so When you implement Serializable interface, then you are letting the compiler (as well as yourself also) know that your class type is serializable.

- 4,586
- 4
- 39
- 72