Help me understand java's write once run everywhere concept.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help me understand java's write once run everywhere concept..

I mean most of the google android apps wont install in an iPhone Os or even a Windows phone even though they are coded in java..where is the platform independence..i know it is pretty obvious to some of you..but honestly i don't understand..so thanks in advance.

14th Oct 2019, 6:03 PM
Allan And Lifted Hands
Allan And Lifted Hands - avatar
3 Answers
+ 3
• What is JVM? Why is Java called the Platform Independent Programming Language? A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could be run on any platform, without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible, because it is aware of the specific instruction lengths and other particularities of the underlying hardware platform. /* Java Interview Questions from Java Code Geeks */
15th Oct 2019, 2:14 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
Imagine it like an adapter. Instead of having the whole code of an application different per operating system, you just have that adapter part fitting the operating system. And on top, at the other end of the specific adapter, comes always the same java code.
14th Oct 2019, 6:37 PM
HonFu
HonFu - avatar
+ 2
in android case, java act as a connector between the runtime/native code. its not about the java itself that you cant run on ios. but the way android specificly design their framework (in java) to only work with their product. if you have a normal java program, not associated with any library/framework specific OS them you're good. it should be able to run in any platform
14th Oct 2019, 6:46 PM
Taste
Taste - avatar