Platform independent means the execution of the program is not restricted by the type of os environment provided...thereby make it possible to process the program at any type of environement available.
Java is a platform independent language becoz of the bytecode magic of java. In java when we execute the source code...it generates the .class file comprising the bytecodes. Bytecodes are easily interpreted by JVM which is available with every type of OS we install.
Whereas C and C++ are complied languages which makes them platform dependent. The source code written in C / C++ gets transformed into an object code which is machine and OS dependent. That's the reason why C and C++ languages are termed as Platform Dependent.
Now when I have a source code that is automating with Apache APIs in windows environment, being dependent on machine as well as OS, How will it run on LINUX?
Hi maverick786us, I think your definition of platform independence is based on the ability of the C++ binaries to run on different platform. You are correct.
But kbw definition of platform independence is C++ if you don't use platform specific API, a program written in standard c++ should compile and run in Windows. The same program un-modified should also compile and run in Linux. This is also correct.
So who is correct or not is depend on individual definition of the word "platform independence" :P
This is an interesting point and has much to do with definitions. Software that is platform independent does not rely on any special features of any single platform, or, if it does, handles those special features such that it can deal with multiple platforms. Some would argue that Java in NOT a platform independent language because it will only run on the Java Platform. There is nothing intrinsic about C/C++ that makes it not platform independent you just have to avoid writing platform specific code.
I would recommend reading around Cross-platform programming.