4 ms·
31. In Java, this code can spin forever if a different thread changes this.done, and it's not a "volatile" member. while(!this.done){ Thread.Sleep(1000); } T
by squirrelicus 8y ago
31. In Java, this code can spin forever if a different thread changes this.done, and it's not a "volatile" member.
while(!this.done){ Thread.Sleep(1000); }
The more I learn about Java, the more I'm shocked at how mostly-identical it is to C#. Except C# is clearly superior in the details. I expected to find something java did better, but I'm coming up short.
- h2j24 8y agoOne interesting article I read had an interesting point: one thing Java does better is to use type Erasure. This was surprising to me because reified types are often touted as one of the best things about C#. The author's argument was that type erasure made implementing different type systems on the JVM easier, because type erasure isn't as strict, which makes the JVM a more attractive language target than the CRT.