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.
10/14/2019 6:03:50 PMAllan And Lifted Hands
4 AnswersNew Answer
• 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 */
Just like a web code, you write the code once, upload it on the server and then you can run it everywhere
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.
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