GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Java vs. Android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java vs. Android" Watch "Java vs. Android" New topic
Author

Java vs. Android

J Kilgrow
Greenhorn

Joined: Oct 05, 2010
Posts: 18
I have a question for Jeff, perhaps you would like to comment on. And it is mainly regarding the book "Learn Java for Android Development".
It has always been my understanding that Google has purposefully avoided associating "Android" and "Java" from the inception of Android to try to avoid the mess that they are going through right now with Oracle (SUN). So, now this book is out and it, clearly, embraces the union between the two names. But, at it's core, Android is not java. It uses language syntax that very closely resembles the Java language but the JVM upon which it runs is, truely, not Java but is an Android VM.
How do you reconcile this?

I don't mean to be confrontational! I just would like to start a discussion about this, mainly, to make sure that everyone is clear about the differences between the two.

Thank you!
J Kilgrow
Greenhorn

Joined: Oct 05, 2010
Posts: 18
I just ran across this article this morning:

http://java.dzone.com/articles/android-101-basics?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+javalobby%2Ffrontpage+%28Javalobby+%2F+Java+Zone%29

So...ok. Dalvik VM is a JVM "mod". But, still not JavaME.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42050
    
  64
There isn't much to reconcile. The language syntax is actually identical, and most of the classes that are in Java 5 can also be found in Android. Minus AWT/Swing and some other packages, plus the Android GUI toolkit and some other packages (like Apache HttpClient). So Android is both a subset of Java 5 and a superset of Java 5.

The VM is different - Java class files can not be used directly in Dalvik. Luckily, the Android SDK has a tool that can convert Java class files to Dalvik class files, and that tool works for just about any Java class file. So, with that extra step, Java class files can be used in Dalvik (as long as they don't use other classes that aren't part of the Android class libraries).


Ping & DNS - my free Android networking tools app
J Kilgrow
Greenhorn

Joined: Oct 05, 2010
Posts: 18
Oh! I did not realize that ADK provided a conversion tool for .class files! Nice! That's probably more relevant for support libraries than it is for front-end logic. But, still a useful tool. Thanks!
 
GeeCON Prague 2014
 
subject: Java vs. Android