My Math Forum  

Go Back   My Math Forum > Science Forums > Computer Science

Computer Science Computer Science Forum


Reply
 
LinkBack Thread Tools Display Modes
August 10th, 2007, 05:35 PM   #1
Senior Member
 
Joined: Apr 2007

Posts: 2,140
Thanks: 0

Java versus C++

Can anyone tell me some advantages and disadvantages of those two programming brands?
johnny is offline  
 
August 10th, 2007, 06:28 PM   #2
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Java is slow and bad at numbers; C++ is fast and exellent at it.

C++ is generally hard to port from system to system (if you use certain subsets of it, it's not too bad); Java is easy to run most anywhere.

C++ is hard to write if you manage your own memory; Java does this for you.

Bad: Java is programming with kid gloves on. C++ is old-fashioned.
Good: Java is interoperable and C++ is blazing fast.

Between the two, I prefer C++.
CRGreathouse is offline  
August 10th, 2007, 06:53 PM   #3
Senior Member
 
Joined: Apr 2007

Posts: 2,140
Thanks: 0

How do I install C++ into my computer, so I can use it?
johnny is offline  
August 11th, 2007, 07:42 AM   #4
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Quote:
Originally Posted by johnny
How do I install C++ into my computer, so I can use it?
There are lots of free compilers, just Google it. If you like full-powered IDEs, MS has Visual C++ Express, which is free. If you want the reigning champion of open-source command-line tools, get gcc (if you have Windows, MinGW and MSYS will let you run gcc and make native Windows executables). There are probably at least a dozen others out there.
CRGreathouse is offline  
August 12th, 2007, 04:11 PM   #5
Senior Member
 
Joined: Nov 2006
From: I'm a figment of my own imagination :?

Posts: 848
Thanks: 0

Wait, microsoft actually has a free program?! Quick, call Bill Gates' doctor! I think Mr. Gates is ill!
roadnottaken is offline  
August 12th, 2007, 04:21 PM   #6
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Quote:
Originally Posted by roadnottaken
Wait, microsoft actually has a free program?! Quick, call Bill Gates' doctor! I think Mr. Gates is ill!
Well if you want to support the poor man, you can always buy one of the commercial versions of it -- Standard and Professional, plus a few others -- they're a few hundred dollars at least.
CRGreathouse is offline  
October 18th, 2007, 11:13 AM   #7
Senior Member
 
Joined: Oct 2007
From: Chicago

Posts: 1,701
Thanks: 3

Quote:
Originally Posted by CRGreathouse
Java is slow and bad at numbers; C++ is fast and exellent at it.

A professor recently told me that java benchmarks are actually getting very close to C... Have any idea where I might confirm or deny that?
cknapp is offline  
October 18th, 2007, 12:25 PM   #8
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Quote:
Originally Posted by cknapp
A professor recently told me that java benchmarks are actually getting very close to C... Have any idea where I might confirm or deny that?
I hear that a lot, but I don't see it. You can look up benchmarks online, but the best way would be to take a program of the type you use, code it in both languages, and compare the runtimes. (It would be hard to compare the programming time, since the second one would always go faster.)

My C++ programs go 1.5 to 2 times faster than my C# programs, which are maybe 20% faster than my Java programs.
CRGreathouse is offline  
October 18th, 2007, 10:47 PM   #9
Senior Member
 
Joined: Oct 2007
From: Chicago

Posts: 1,701
Thanks: 3

Quote:
Originally Posted by CRGreathouse
Quote:
Originally Posted by cknapp
A professor recently told me that java benchmarks are actually getting very close to C... Have any idea where I might confirm or deny that?
I hear that a lot, but I don't see it. You can look up benchmarks online, but the best way would be to take a program of the type you use, code it in both languages, and compare the runtimes. (It would be hard to compare the programming time, since the second one would always go faster.)

My C++ programs go 1.5 to 2 times faster than my C# programs, which are maybe 20% faster than my Java programs.
Yeah, I was shocked as well... Then again, we may have been talking about time complexity at the time, so it could well be that it is "very close" to C, as he said, but that pesky little constant is greater.

Considering that Java runs on top of other things, this would make the most sense.
cknapp is offline  
October 19th, 2007, 05:35 AM   #10
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 937

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Quote:
Originally Posted by cknapp
Yeah, I was shocked as well... Then again, we may have been talking about time complexity at the time, so it could well be that it is "very close" to C, as he said, but that pesky little constant is greater.

Considering that Java runs on top of other things, this would make the most sense.
Unless you're using Java's bignums (which are terrible -- I mean worse than I can explain terrible) the Big-O complexity is the same.
CRGreathouse is offline  
Reply

  My Math Forum > Science Forums > Computer Science

Tags
java, versus



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java 2 methods help JamesKirk Computer Science 0 February 26th, 2011 12:13 PM
The Java Closure controversy John Creighton Computer Science 1 October 28th, 2010 12:22 PM
java problem cire09 Computer Science 1 October 9th, 2010 06:54 AM
Java code Quantum++ Computer Science 1 September 16th, 2010 10:22 AM
Java - NetBeans Mark Computer Science 5 October 30th, 2007 08:49 AM





Copyright © 2017 My Math Forum. All rights reserved.