I was working with a class extending a Swing
Object Class (e.g. public myClass extends JFrame
) and with methods/variables referring to Screen objects/DisplayMode/Graphics
.
There were no issues. However when I tried to cast Grphics
instance g
to a Graphics2D
object, I have gotten, seem-to-be-common error as explained in multiple places of SE with great answers and information.
I AM CURIOUS! Because I managed to solve the issue without adding a serialVersionID or without implementing serializable interface. And as said I don't need my class to be serialized. Since it was solved without having to implement/extend serializable interface or adding serialVersionID - I am just curious to understand in what scenarios compiler decides or treats a class as or better be serialized...I am not sure how else I can explain this.
What I want to know, how/under what criteria does Java Compiler qualify a class as a serializable and demand a Serial ID? In my case neither I required a serialization nor did I specify one.