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

William L. Thomson Jr. support at obsidian-studios.com
Tue May 6 20:25:02 PDT 2003


On Tue, 2003-05-06 at 23:13, Chad Krsek wrote:
>
> 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.

You can most definitely make system calls in Java. No different than in
C++ except syntax differences of course.

> 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.

It all depends on intended use and programing ability. Java is easier to
learn and implement things like threads and catching. Doing that with
C++ is not novice stuff at all. Maybe threads, but most definitely not
catching.

> 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 what manner are you referring to system calls?

> 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.

That's not always the case. Java can be used in most places C++ can be
used. Yes Java has a layer of interpretation, but you can still access
"low level functionality"

However generally when you are working with low level things like
drivers, kernels, etc. you will use C, not C++ or Java.

> 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,

Not all.

>  I
> think, whereas there are a ton of third party
> libraries for c++

I would say that with Java you pretty much get all the libraries you
need with your JDK or JRE. With the exception of some. With C++ you are
pretty much dependent on what your env provides you. Or what you can
find or get your eyes and hands on.

> 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.

I agree on this point. With C++ most of the time you want to write you
own libraries, if they are not part of your os/distro or env.

-- 
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios, Inc.
3548 Jamestown Ln.
Jacksonville, FL 32223
Phone/Fax  904.260.2445
http://www.obsidian-studios.com




More information about the talk mailing list