Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java [What are the differences between Java and C++?]

 
Jayashri Bolage
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are difference between the java and c++?
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This one & this from wikipedia have some good comparisons. And please carefully choose one forum when posting here.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this recent topic.

Please use a meaningful subject line instead of "java" when you post a question.
 
s.palanivel rajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
these are the techniques which are not allowed in java but allowed in c++

Pointers
Structures & unions
Operator overloading
Multiple inheritance
Goto operator
Automatic type conversion
Destructors
Unsigned integers
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s.palanivel rajan wrote:these are the techniques which are not allowed in java but allowed in c++

Pointers

Thank the gods, pointers are how you program in assembly language. They are the source of untold bugs.

s.palanivel rajan wrote:Structures & unions


While technically correct, a java Class is the same as a 'struct' if you don't have any functions.

s.palanivel rajan wrote:Operator overloading


This was popular in languages designed in the 70s, Ada, C++, etc. And the example was always dealing with Strings or Complex numbers.
The problem is, that a decent language should have Strings (and probably Complex) build in, and when you have that, then the obvious uses of operator overloading are rare.

s.palanivel rajan wrote:Multiple inheritance


The bain of my existence when I was a C++ developer

s.palanivel rajan wrote:Goto operator


GOTO considered dangerous. Was true when Djkistra wrote it, and is still true today

s.palanivel rajan wrote:Automatic type conversion


Actually, Java has this for some cases. Strict language designs discourage it.

s.palanivel rajan wrote:Destructors

another huge source of bugs, handling destuctors properly with exceptions is a real challange.

s.palanivel rajan wrote:Unsigned integers

I don't see this as a problem, but not having unsigned byte data is a pain for crypto code
 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I see it c++ puts more control over system resources in the hands of the programmer. As a result c++ offers a bit more flexibility when it comes to optimizing some performance critical applications.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fred Hamilton wrote:As I see it c++ puts more control over system resources in the hands of the programmer. As a result c++ offers a bit more flexibility when it comes to optimizing some performance critical applications.


In practice, this is true for perhaps as much as one percent of all applications. Or rather, the claimed performance improvement is worthwhile in as much as one percent of the cases. The rest of the time, i.e. the vast majority of all times, the programmer productivity gained by not having to worry about stuff like destructors and memory allocation is a net win.

A decade or more ago, the performance penalty was real and had more impact. With modern JIT optimizations, its rare when the real world performance is an issue, its nearly always the DBMS or the Webserver or the user that is the bottleneck.

A lot of the things that are "more control" are things that humans do not do very well.

 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:
Fred Hamilton wrote:As I see it c++ puts more control over system resources in the hands of the programmer. As a result c++ offers a bit more flexibility when it comes to optimizing some performance critical applications.


In practice, this is true for perhaps as much as one percent of all applications. Or rather, the claimed performance improvement is worthwhile in as much as one percent of the cases. The rest of the time, i.e. the vast majority of all times, the programmer productivity gained by not having to worry about stuff like destructors and memory allocation is a net win.

A decade or more ago, the performance penalty was real and had more impact. With modern JIT optimizations, its rare when the real world performance is an issue, its nearly always the DBMS or the Webserver or the user that is the bottleneck.

A lot of the things that are "more control" are things that humans do not do very well.



Well sure, no disagreement, if programmer productivity is a prime concern, then yeah. But I was talking about cases where performance is a prime concern, and programmers that can make use of the control.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic