Why was Java chosen for Android, instead of something like C++? I have heard that Java uses quite a lot of memory and I would presume that low memory usage would be quite important on mobile devices. Is there any real advantage to using Java instead of a language like C++ on a mobile device?
This article sheds some light on the situation. The most pertinent link within that article is this. So you've got a massive install base with lots of programmers who know the language and it's widely taught at universities. C++ was dropped from my school's curriculum, Java is still here. Java has Java ME which has a massive install base on other cellphones. The Pantec Ease I have in my pocket right now has a little coffee cup in the corner of the screen. Anyone care to guess what that is?
This answer on Stack Overflow covers it pretty well too.
Summary of SO answer:
java is a known language, developers know it and don't have to learn it
its harder to shoot yourself with java than with c, c++ code since it has no pointer arithmetic
it runs in a vm, so no need to recompile it for every phone out there and easy to secure
large number of developement tools for java (see first)
several mobile phones already used java me, so java was known in the industry
the speed difference is not an issue for most applications, if it were you should code in assembly
I'll hazard a guess that Google choose Java for familiarity, if nothing else. Many of Google's projects revolve at least concepts of Java schematics (GWT for example).
Also remember that Android came in a little late to the party. Forcing developers to use C++, a low-level compiling language, would make it harder to generate a 'wow' factor, and if nothing else, Android needed numbers (of apps) and flashiness to get off the ground.
Not sure why exactly Java was chosen but it was probably for a number of reasons
To capture the large group of developers who are familiar with and use Java
Fill the mobile gap in Java where technologies like J2ME where Java is lacking.
Secondly, there is not Java Virtual Machine specified for Android. Instead all Java code is compiled for running on Dalvik, which is a lightweight, optimized VM specifically designed for running in mobile environments. It purportedly enhances battery life and maximizes efficient use of resources.
protected by gnat Jun 26 '14 at 6:37
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?