Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
When Android was first announced, its use of the Java programming language brought with it some mixed reviews. The main alternative in embedded systems is native code—something that can be compiled to machine directly, such as C, C++, or Objective-C. Compared to those languages, Java is advanced. For example, it’s the only one that has garbage collection. (Objective-C 2.0 has a flavor of garbage collection, but it hasn’t yet found its way into the mobile space.) Many developers consider Java to be overly verbose and restrictive, and in general “long in the tooth.” There are many newer programming languages with more flexible and expressive syntax. Fortunately for aficionados of such languages, Android doesn’t require Java. It requires Java bytecode. Any language that can compile to Java bytecode can then be dexed to Dalvik bytecode that can then run on an Android device. Let’s look at figure B.2 to see how this works.