3 ms·
Has something dramatically changed in the last several years? Java supported casts last time I used it (admittedly ... in the 1.6 era)
by warrenm 4y ago
Has something dramatically changed in the last several years? Java supported casts last time I used it (admittedly ... in the 1.6 era)
- Thiez 4y agoNot like C. Try building a xor-linked list in Java.
- warrenm 4y agoan "xor-linked list"?
- Thiez 4y agoI imagine typing that comment took about as much effort typing those words on your search engine would have taken. Read this: https://en.m.wikipedia.org/wiki/XOR_linked_list https://en.m.wikipedia.org/wiki/XOR_linked_list It is a datastructure that can easily be implemented in C but cannot be implemented directly on the JVM.
- ablob 4y agoA java cast is fundamentally different from a c cast, if thats what you're aiming at. In C, you ask the compiler to treat a memory location differently (in some cases it also implies a conversion), while in java you ask the compiler to check, whether an object is of a specific type and only if it is, then you get to treat that object in that way. Edit: casts and conversions are unfortunatelly written the same way This is what is meant when people say that Java is type-safe. If you cast a car into a bird a java program will enter a failure-mode, while the C program will tag along happily without further notice.