• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exact Difference between c and java

 
Ravi kapa
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49813
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C is a Procedure Oriented Programming Language

Java is Object Oriented Programming Language
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic