wood burning stoves 2.0*
The moose likes C / C++ and the fly likes Exact Difference between c and java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Exact Difference between c and java" Watch "Exact Difference between c and java" New topic
Author

Exact Difference between c and java

Ravi kapa
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
Hi,i have a doubt about the difference between c and java i read the articles but they did not help me to understand(like definitions) i need more clarity about it is anyone suggest me how to get that stuff that is very clear and better to understand...???
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
To appreciate the difference between them, you should know both the languages.

Are you trying to ask how network programming is done in C and in Java, because, I see the e question posted under

JavaRanch » Java Forums » Sockets and Internet Protocols thread.

Ravi kapa wrote:i read the articles but they did not help me


Did you read online? Can you provide some links and what you did not understand?




Me thinking... if SOPA/PIPA get passed, it might put us in trouble for discussing those articles.


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Did you mean C or C++?

C is not object oriented, it is a procedural language. C++ is a set of object-oriented extensions on to of C. Java is object-oriented. The basic syntax of Java come from C and C++.

All three (C, C++, Java) come with libraries of pre-written functions/objects. You can also get additional libraries for all three. But the types of functionality provided by each of those sets of libraries is vastly different (though there are overlaps).

In C/C++, you have to manage memory your self. You often have direct access to the hardware (as much as the OS will allow). And you can do incredibly strange and wonderful and often dangerous things with C/C++. In Java you are much more restricted, you can't get at memory or hardware directly (but there are often methods for doing some things), and Java itself relies on libraries written in C/C++ to access OS functions (even networking). Also, Java manages memory for you, including cleaning up unused objects and thus freeing memory.

C/C++ compiles into machine code directly processed by the CPU. Java gets compiled into intermediate opcodes which are initially interpreted by the JVM but ultimately compiled at runtime into machine code. A C/C++ program must be recompiled for every platform it will run on. A Java program can be run on any platform that has a JVM without any recompilation.

All three are similar enough that if you know one you should be able to write simple programs in any of the others. All three are different enough that you have to learn how to think in that language before you can really master it.

I think that covers the basics, but I'm sure I missed some.


JBoss In Action
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37970
    
  22
That’s far better than I would have managed.
I think this might sit better in the C/C++ forum, so I shall move it.
Ifteqar Ald
Ranch Hand

Joined: Dec 26, 2011
Posts: 73
C is a Procedure Oriented Programming Language

Java is Object Oriented Programming Language
 
Consider Paul's rocket mass heater.
 
subject: Exact Difference between c and java
 
Similar Threads
Difference between SSL and HTTPS implementation in Servlets/Web Server?
java [What are the differences between Java and C++?]
Why Ruby?
What is CMT and BMT?
java [question -- difference between java and c]