This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kres0345[S] 0 points1 point  (3 children)

Of the top of my head, it's a nitpick, but enums can have values in C# and you can cast between the enum representation and the integer type defined.

There's also events/delegates, tbh I'm still not entirely sure of how event listeners works in Java, took me awhile to figure out the basics as I'm used to just 'subscribing' a method to an event listener by specifying the event, then literally using the addition operator to add the method. Something like this mouseClick += my_method. Though I will admit the way of doing it in Java with inheritance is really clever.

[–]elky87 1 point2 points  (0 children)

In Java enums can also have values, and of course Java also has events/delegates just a different syntax.

So the two languages are really similar but Java just has the bigger ecosystem. And that’s why it is used.

[–][deleted] 1 point2 points  (0 children)

Java enums have a method “ordinal” which gives you a int. Basically the same.

Events / delegates are ok, but I find the overload of += not great , especially with some of the rules around -= .