everyone say that java is widely used because of its platform independency.
it is platform independent because we can write JVMs for any platform,right?(i hope so)
so...similarly c/c++ can be called platform independent if someone can write c compilers for other platforms...
why cannot someone write c compilers for someother platforms and make it platform independent??
may be i'm insane about asking this...but somebody clear me please..?
Sun is not the only company that makes the JRE; for example Apple makes their own version of the JDK and JRE for Mac OS X and IBM and HP also have their own Java implementations for the servers that they make.
The difference between Java and C or C++ in this regard is that Java programs are binary compatible - you don't have to recompile your Java program to make it work on another operating system.
When you write software in C or C++, you almost always use the API of the specific operating system you write your software for. Each operating system has its own API, and the APIs of for example Windows, Linux and Mac OS X are totally different. If you wrote a program for Windows, then you cannot just compile it for Linux or Mac OS X and it works - you most likely have to rewrite a large part of the program to make it work on another OS.
There are some standard APIs that some operating systems implement (POSIX for example), but you almost always need more than that for a real program. Especially the GUI systems of different operating systems are totally different from each other.
So, software in C or C++ is most of the time not platform-independent or even portable at all.