java - how does a compiler knows which class need to be serialize -


if declare class serializable, how compiler know class needs serialized using serializable keyword.

public class domain implements comparable<domain>, serializable{  } 

compiler not serialize class, need write code write/ read object output stream. if class trying serialize not implementing interface, jvm throw run time error.

as marked class seriablizable implementing serializable interface, jvmwill treat serializable class. serialzable marker interface, means there no method need implemented when add interface class. marker interfaces treated specially jvm, flag class serializable.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -