once you write a java program, you compile it into class files. you can drop those .class files onto any machine that has a JVM, and they will run.
With a language like C, you write your file, you compile it into a .exe file. BUT, you have to compile a .exe file for Windows XP, a different .exe for Unix, a different .exe for linux, a different .exe for MacOS...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors