3 ms·
C is not cross-platform; you need to compile for each target platform. Java compiles to byte-code which runs on a Java VM, of which there is an implementation o
by askvictor 4y ago
C is not cross-platform; you need to compile for each target platform. Java compiles to byte-code which runs on a Java VM, of which there is an implementation on different platforms; you only compile your program once and it will run anywhere there is a JVM. For console/server/webapps applications, this is pretty easy, but for GUI applications it's a bit trickier as each OS has a different look, which is more difficult to abstract. So some applications might have the core running in Java, and a native UI wrapper that provides a native look and feel. But they can be completely Java based (and it's gotten a lot better at dealing with multiple GUI system over time).
While they run on a different VM (Dalvik), Android programs are (mostly) written in Java, and provide a cross-platform function - namely different CPUs (Android can come in ARM, ARM64, x86, x64, MIPS), and all run the same binary (except if there's native extensions... which negates all of that)