Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Exact Difference between c and java

 
Ranch Hand
Posts: 128
  • 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...???
 
Ranch Hand
Posts: 1609
  • 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.
 
author
Posts: 5856
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.
 
Marshal
Posts: 69035
275
  • 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.
 
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
 
What are you doing in my house? Get 'em tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic