[NBLUG/talk] Java v. C++ in Linux

Chad Krsek ckrsek at yahoo.com
Tue May 6 20:11:01 PDT 2003


> Also, between Java and C++, which is the better
> language?

A little more on this...

These languages really are geared towards two
different problem sets, with some overlap.

Java is platform independent, i.e. your code will work
in linux, windows, mac, etc.  All that is required is
the Java VM or plugin to be installed.  In c++ you
would need to recompile your program for each
environment, and depending on what your doing, much of
the code may have to be changed.

For instance, in java, you can't make any system
calls, whereas in c++ you definitly can, but they are
differnet from platform to platform.

If you are making a card game, java may be the way to
go.  You could create an Applet, and anyone on any
machine could run the program throough a webpage.

On the other hand, if your writing a multi-threaded
search application, you'd really want to use c++, as
it would be faster, and becuae Java only supports user
level threads.

Further, if you want to do systems programming, and
say, manage some device, you'd have to use c++, as
there are no direct system calls in Java.

In general, you could say that java only supports high
level programing, i.e. many layers away from the
actual OS and hardware, whereas c++ supports high
level, and low-level, i.e. direct manipulation of the
system.

Both java and C++ have a large amount of supporting
libraries.  Sometimes java's libraries can be more
helpful, because they are all developed by Sun, I
think, whereas there are a ton of third party
libraries for c++

A case in point, if you need to compute
300^19313mod987 (and you don't know your number
theory), you could simply use the modpow function in
java's BigInteger library.  If you were using c++,
you'd probably have to scour the web for a library
written by joe somebody that supports such huge
calculations, but you may never know for sure how
reliable it is, or if it even works.





__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the talk mailing list