I noticed when I have Serializable
instead of Serializable()
, the code still compiles.
Is there a rule for this that you can omit the parenthesis? Is it a good practice? It seems more readable to me unless I am missing something.
I noticed when I have Serializable
instead of Serializable()
, the code still compiles.
Is there a rule for this that you can omit the parenthesis? Is it a good practice? It seems more readable to me unless I am missing something.
There's no particular rule regarding best practices that I've seen anywehere on the subect.
Generally, I find that people who hand-type their attributes omit the empty parens, but code generation almost always explicitly includes them.
Yes omitting the attribute is legal from a language standpoint. I don't know of any best practices surrounding it but in general I find developers omit the parens if they're not necessary.