I found that Object class
in java is not serializable in java at the end when i've wasted much time for a problem.
So can anybody knows another class's those are not serializable or any way to check whether that class is serializable?
Use
if(someObj instanceof Serializable) // recommended because it uses
// the byte code instruction INSTANCEOF
or
if(Serializable.class.isInstance(someObj))
Using Class.isInstance(someObj)
makes sense if the Class
should be replaceable at runtime.
For example:
Class<?> someClass == ....; // assign a class object reference dynamically
if(someClass.isInstance(someObj))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments