ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Why Java is Independent?

user-image
تم إضافة السؤال من قبل Ankit Gomkar , Associate Software Engineer , TechNex Technologies Pvt Ltd
تاريخ النشر: 2014/10/08
Nihanth Christopher
من قبل Nihanth Christopher , Senior Software Engineer , Advanced Data Technologies (Pvt) Ltd, ADS Group

Java is both compiler and interpreter language. When compile a Java program it creates ".class" file which is collection of byte code, these byte code are not machine instruction instead they are instruction which Java virtual machine can understand. Since every Java program runs on Java virtual machine, same byte code can be run on any platform. key is byte code is not machine instruction they are platform independent instruction to JVM. On the other hand JVM or Java virtual machine is platform dependent because it converts byte code into machine level instruction which is platform specific and that's why you have different version of JDK and JRE for windows and Linux because both JDK and JRE comes with Java virtual machine.

Ankit Gomkar
من قبل Ankit Gomkar , Associate Software Engineer , TechNex Technologies Pvt Ltd

Java is Independent due to the shifting of machine language creation from compilation phase to execution phase with the help of bytecode and JVM.

 

FOR dependent languages like c,c++:

Assume client-server architecher, If we compile any program on server(contaning Windows as OS) it genrate a machine lanquage and wrap it into an ".obj file", if we pass that ".obj file" to the client(contaning Linux as OS) it's unable to execute that, because the generated machine language on server side is compaitaible only for server OS(here Windows) if on client side at execution time he find a same OS as of server he execute and show output properly else unable to do so.

 

For JAVA:

If we compile any program on server,(know mattter what OS he containing) it generates a specific byte code and when we send it to client and try to run ,a JVM allow that to do so without matteing of OS.

 

Conclusion:

A byte code genration and that execution with JVM allows Java to overcome on dependency problem of other languages.and Thus, Java is independent.(but not a JVM, "JVM is Platform Dependent" there are different JVM softwares for different OS).

Abdulelah Fallatah
من قبل Abdulelah Fallatah , Tech-Support Specialist & Programmer , Al-Rayan Colleges

I think you mean "portable" not "independent".

 

It's portable because the lines of code of Java can work on any type of operating system.

Ritesh Ramteke
من قبل Ritesh Ramteke , Software Developer , Orange Snipers Infotech

Just because when java file is compiled it generates .class file which is capable of run on any platform.  Hence java is platform independent language 

prathap T
من قبل prathap T

java is independent because to write program in one system(windows system) to compile that program.After compilation one .class is created you observe that to run that run that program other system the output will seen......

المزيد من الأسئلة المماثلة