Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

How Do Java And C Differ?


  • Please log in to reply
13 replies to this topic

#1 vinith_04

vinith_04

  • Members
  • 31 posts
  • OFFLINE
  •  
  • Location:Mangalore
  • Local time:11:24 PM

Posted 09 February 2006 - 02:17 AM

Hi
I just wanted to know the differences between Java and C programming.
Please help me regarding this.
It would be a great favour.


Vinith

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:54 AM

Posted 09 February 2006 - 10:07 PM

For starters. C is a compiled language, Java is an interpreted language. C is horrible and nasty, and thus way more powerful. (It's not really horrible or nasty). Java handles much of the houskeeping automatically. Java is object oriented, C isn't.. well, it is, but it isn't....

#3 Heretic Monkey

Heretic Monkey

  • Members
  • 1,122 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NCSU
  • Local time:01:54 PM

Posted 10 February 2006 - 12:39 AM

Lol, simple comparison groovicus.

One of the big things that attracted me to Java was the idea of cross-platform compatibility. I'm taking a beginners course in Java programming at NCSU. Since java runs on a virtual machine through the terminal, it can be run on almost every operating system with very little effort.

The way i've been told, Java isn't THAT much different from C, but groovicus is right. C is a heck of a lot more powerful, but also more complicated.

#4 acklan

acklan

    Bleepin' cat's meow


  • Members
  • 8,529 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Baton Rouge, La.
  • Local time:11:54 AM

Posted 10 February 2006 - 09:44 PM

:thumbsup:
"2007 & 2008 Windows Shell/User Award"

#5 Swandog46

Swandog46

  • Members
  • 134 posts
  • OFFLINE
  •  
  • Local time:01:54 PM

Posted 13 February 2006 - 12:14 AM

C is horrible and nasty

Respectfully differ! :thumbsup:
I like C very much, and if you master C, you can do literally anything. Plus, most of the features anyone likes in Java are out there as extensions to C in C++ as well. And if you're trying to do scripting, you shouldn't be using Java or C anyway. :flowers:

#6 tsg1zzn

tsg1zzn

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:07:54 PM

Posted 13 February 2006 - 06:08 AM

If Java's garbage collector worked properly there would be no Java programs left on this planet.

Seriously, Java is well suited for two things, and that's server-side programming and useless web applets. It is not suited for normal GUI applications or games.

Why not GUI applications? Because Java doesn't use an os-native GUI. And if it did, it wouldn't be quite as cross-platform as advertized any more.

Also, it has a tendency to "run fast after the first time". The first time you do something it's rather slow, but the next time it's just as fast as C was all the time. When it comes to server-side programming this does not matter much because if a java program serves one million visitors it will only be slow the first time. However, if this was a GUI app, how often do you change a preference option a million times straight after each other? Almost always, if you change a preference, insert a table or whatever you do, you do it once and you're done with it. And then it doesn't matter if it's just as fast as C all the 9999999 times you DIDN'T click that button.

#7 Craigory

Craigory

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Local time:12:54 PM

Posted 18 February 2006 - 02:28 PM

@tsg1zzn, I've always noticed that when compiling/running new java applications after a while of not using java.

C, I'm sure, doesn't require error handling.

Java forces you to use error handling (try - catch), really, it does, because if you don't use it the compiler will bi*** at you.

Edited by Craigory, 19 February 2006 - 02:28 PM.


#8 -David-

-David-

  • Members
  • 10,603 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:London
  • Local time:06:54 PM

Posted 18 February 2006 - 02:41 PM

Here's a very in depth, but useful link:
http://www.comp.lancs.ac.uk/computing/user...va2c/diffs.html
David

#9 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:54 AM

Posted 18 February 2006 - 03:01 PM

Why not GUI applications? Because Java doesn't use an os-native GUI. And if it did, it wouldn't be quite as cross-platform as advertized any more.


I'm not sure I follow that logic. It doesn't use os-native GUI, because if it did, it wouldn't be cross platform... huh? ... none of Java is OS specific, that's the point.

Would you maybe care to elucidate the point at which you were grasping, because at this point you have two thirds of the argument.

BTW, the java GUI works just fine.. it looks a bit different from system to system, but so what? My clients are very happy with it... it is much less painless than trying to put together a C++ GUI ... Oh yeah, you can't....C++ has no integrated GUI library.. you have to use the Win32 API (not cross platform), and I have no idea what one would use for a 'nix platform.

C GUI's are built on what?? Does C have an integrated GUI library? The Win32 API.. again, not cross platform.

Maybe you can help me out here. :thumbsup:

#10 Swandog46

Swandog46

  • Members
  • 134 posts
  • OFFLINE
  •  
  • Local time:01:54 PM

Posted 18 February 2006 - 03:40 PM

The argument is that BECAUSE Java is cross-platform, it cannot be compiled to entirely platform-native assembly code. That step has to take place at run-time, rather than compile-time like in a language like C. That makes Java inherently slower, at least the first time a program is run, for it to be internally compiled/assembled.

I've never tried to write a cross-platform GUI, so I've never needed Java's portability in that regard --- but in that case groovicus, you would certainly have a good point.

#11 Kruncher

Kruncher

  • Members
  • 45 posts
  • OFFLINE
  •  
  • Local time:11:54 AM

Posted 18 February 2006 - 04:13 PM

Alot of people say C is hard to learn. I have no clue what they're talking about. I started with C (even before I touched such things as: HTML or Javascript). C is powerful and easy (in my opinion) to use. C (becaused its compiled) can create such great things as the Linux kernel, and platform independent programs.

#12 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:54 AM

Posted 18 February 2006 - 04:33 PM

I don't mean to start a which os is best thread. So as long as we keep that in mind, I'll leave the thread open.

I am just trying to understand the argument as stated, because at teh time, it didn't seem to be complete. In the context swandog stated, it sort of makes sense... I think.. I'm still not sure.

What does one use for GUI libraries for C then? Are they cross platform, or platform specific. I imagine that since C++ uses the Win32API, then so does C.

??

#13 Kruncher

Kruncher

  • Members
  • 45 posts
  • OFFLINE
  •  
  • Local time:11:54 AM

Posted 18 February 2006 - 08:29 PM

The best cross-platform GUI IMHO is GTK+. GTK+ is C in nature, but it has bindings in many languages (python, C++, etc.). There is also wxWidgets, QT and other lesser known ones. GTK+ is what alot of the windows managers in Linux are programed in (Gnome, XFCE, etc). QT is what KDE is programed in (another Linux window manager). I have personally never touched wxWidgets but I hear it is similar to MFC in windows.

#14 Swandog46

Swandog46

  • Members
  • 134 posts
  • OFFLINE
  •  
  • Local time:01:54 PM

Posted 19 February 2006 - 10:57 AM

GUI libraries for C are platform-specific. The only guaranteed platform-independent portion of C is the actual ANSI standard and the base language. All extensions to it (including, technically, the entire standard library) are NOT technically part of C itself. So all the GUI libraries are platform dependent, implemented by platform vendors (i.e. the Windows API).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users