hi all, please can anyone tell me what is platform independence.
Joined: Dec 01, 2000
hello geetha , i am also a java beginner and will try to give answer as per my experience and knowledge. let us a take example of C code. if one has written the code in C and compiled it on one machine say on windows then CPU will generate the executable file for that code. so programmer has just to excute that file. Now this file is created in binary language which will be understood by only windows and not by any other system. so when that programmer wants to run the same C code file on other system like macantosh then whole C code has to be ported to the new system, this is because only copying binary excutable from previous windows system won't run the program as this binary language is specific to each type of system. This is system dependency. Exactly reverse is system indepedency. So in java if code file that is ".java" file is compiled on windows then it generates ".class" file. So this ".class" file is enough to port on any other system. There is no need to transfer all the code that is all the ".java" files. This happens because JVM (Java Virtual Machine) inserts one more stage before creating the binary executable and that is converting java code into byte codes using interpreter facility. This byte code is independent of any machine and can run on any type of machine provided JVM is available on the system. Then this byte code get converted into binary language using compiler. Thus java is platform independent language. I hope you have got your answer.
Joined: Oct 15, 2000
couldn't have said it better myself ------------------ I wish there was a button on my monitor to turn up the intellegince. Theres a button called 'brightness' but it doesn't work
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
Joined: Dec 01, 2000
hi parag!! thanx for ur reply.i'm very much clear with ur answer.