The main target of developing the Java language was "WRITE ONE, RUN ANYWHERE". It means the code you are writing is machine-independent. If you are writing any program that particular program will run on every operating system. There is no need to write a program again for another operating system. In the case of C and C++, the codes are machine-dependent. So to make your program run on every platform you have to write an individual program for every platform.