In the following code
Vector v = new Vector();
v.add('c');
v.add('c') is allowed in 1.5 and I thought it’s may be because of autoboxing feature of 1.5.
But I was surprised to see that in 1.4 v.add('c') a character literal is allowed as an object type method parameter of the add method.
Does this mean character literal considered as an object?
before posting question here I crosschecked on my Intellij IDE by doing “Integer i = 1” and IDE showed red error symbols over the line. but IDE failed to do so on v.add(‘Y’) statement. It didn’t show any error.
Anyways its clear now. v.add(‘Y’) doesn’t compile in 1.4 or older version.
Thanks for your inputs. I believe sometimes its better to go to shell and check there. hmmm…
It doesn’t compile with source compatibility set to 1.4: