New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
foboi1122
Old
#1  
Senior Member - OP
Thanks Meter 32
Posts: 99
Join Date: Dec 2011
Default [Q] C Kernel vs Java Applications

Kind of off topic, but does anyone know why applications are written in java when the Kernel is written in C? It seems to me that if the applications were directly written in C, it would save the machine some effort in translating java code into bytecode as well as increase program speeds?
 
TalynOne
Old
#2  
Senior Member
Thanks Meter 31
Posts: 302
Join Date: Jun 2007
For a developer writing something in C is a lot harder and takes a lot longer than writing the equivalent in in Java, plus afaik a lot of the Google APIs are not available in C.

For an analogy do you think the average writer would you rather hand write a 500 page book or use a computer to accomplish the same task.
 
foboi1122
Old
#3  
Senior Member - OP
Thanks Meter 32
Posts: 99
Join Date: Dec 2011
Ah gotcha... that makes sense. Thanks
 
Mithent
Old
#4  
Senior Member
Thanks Meter 21
Posts: 292
Join Date: Feb 2009
It is possible to program for Android using native code (C/C++):

http://developer.android.com/sdk/ndk/index.html
 
rand4ll
Old
#5  
Senior Member
Thanks Meter 81
Posts: 539
Join Date: Jan 2011
Quote:
Originally Posted by foboi1122 View Post
Kind of off topic, but does anyone know why applications are written in java when the Kernel is written in C? It seems to me that if the applications were directly written in C, it would save the machine some effort in translating java code into bytecode as well as increase program speeds?
Also Java comes with lots of protection for the end user. Since its running in a jvm it gives good system protection from an application bringing down the entire system(think of BSOD in windows). It also does a great bit of memory management with its built in garbage collecting. With c you have to do all this memory management yourself and can be quite difficult to do 100% correctly, especially with complex applications, causing memory leaks. Yes it does add some overhead with the jvm running but with the power of today's devices it is negligable.

Sent from my Transformer Prime TF201 using xda premium
Tags
java, kernel