The moose likes Java in General and the fly likes Java Uses C? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Uses C?" Watch "Java Uses C?" New topic
Author

Java Uses C?

Sahil Reddy
Ranch Hand

Joined: Jan 24, 2011
Posts: 145
Hello pals

Some of us are discussing the following and are unable to come to some conclusion ......so decide to ask the geeky people over here....

1. Does JAVA code converts into C Code ?
2. Does JAVA code uses C Code ?
3. Is it possible to write JVM which does not use any C language and converts directly to Assembly.
4. Is it possible to use JAVA language to access memory similar to the way we use pointers in C Language ?

Thanks and Regards
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Sahil Reddy wrote:Hello pals

Some of us are discussing the following and are unable to come to some conclusion ......so decide to ask the geeky people over here....

First, it's "Java", not "JAVA". It's not an acronym.

1. Does JAVA code converts into C Code ?


No. Java source is compiled into Java bytecode.

2. Does JAVA code uses C Code ?


Depends what you mean by "Java" and what you mean by "uses". The most commoin JVM implementations are written partially in C or C++, but it's not a requirement.

3. Is it possible to write JVM which does not use any C language and converts directly to Assembly.


What do you mean?

A JVM is typically written partly in C or C++ and partly in Java. When it's executing, it converts the Java bytecodes to the machine language for the platform on which it's running. You seem to think that there's a conversion to C code in the middle. That's not the case. You also seem to think that "Assembly" is a single language. It's not. Each architecture has its own machine language, and each of those has its own assembly language (possibly more than one, at least in theory).

4. Is it possible to use JAVA language to access memory similar to the way we use pointers in C Language ?


No.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

Jeff Verdegan wrote:
4. Is it possible to use JAVA language to access memory similar to the way we use pointers in C Language ?


No.

But it is possible to write C code and integrate that into Java, using JNI.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

native method calls(that must be what JNI stands for). you can call c or c++ code from a java program. you can maybe even call VB code for all i know.


SCJP
Visit my download page
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Java, not JAVA. It's not an acronym.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java Uses C?