Originally posted by Ernest Friedman-Hill: ... And you posted this using...?
Doh! That never even occurred to me.
John King
Ranch Hand
Joined: Aug 27, 2002
Posts: 165
posted
0
Originally posted by Ernest Friedman-Hill:
And you posted this using...?
I was using a terminal that only allows me to browse the Internet in a public place. Thanks guys.
I tested it. As Marc said, it compiles fine. It was an interview question. I do not understand why Java allows this type of casting. It seems not very useful.
There are hundreds of ways to write useless and pointless code in Java. But trying to write a language definition that makes code like "i = i++" illegal because it doesn't do anything and does it in a confusing way, for example, would be extremely difficult. It's better to just write a simple language and let programmers do what they will.