when u compile a java program it will create the code which JVM(Java Virtual
Machine) can understand & execute.
.class files are in the form of Byte code.
but if u r compiling a .c program & .cpp program the compiler will create the
.obj & .exe files. in my belief .exe is in machine code which can executed by
the operating system itself only where it was compiled. you can't execute the
same .exe file in diff o/s.
for example u can't compile a program in dos/windows O/S and u can't run in
Linux/ Solaris platform. becoz the compiled code was O/S oriented.
but Java programs are compiled for the JVM not for OS, so if there is an
compatible JVM in any OS u can run the same .class file. (with certain
restrictions., like filesystem, filehandling, etc.,) JVM will take care of OS
calls.
.NET compilers also has new idea of CLR(Common Language Runtime), like JVM it
compiles more than one language and create code for the CLR, so u can compile
multiple languages and make a same code, for ex u can compile COBOL,C++,C#
programs for CLR & run it through .NET framework.
all these things are just my beliefs only, if anything is wrong plz let me
know...