Comparison of Java to Cplusplus

This is a comparison of the Java programming language to the C++ programming language.

Table of contents
1 Advantages of Java
2 Disadvantages of Java
3 Advantages of C++
4 Disadvantages of C++
5 Differences between the languages
6 External References:

Advantages of Java

  • The extensive and standardized Java API makes it considerably easier to program in Java than in C++. The standard Java API included with every modern JVM includes built in, standardized libraries for TCP/IP network sockets and services, XML parsing, logging, SQL database access, cryptography, and many other areas. C++ libraries which perform similar functions to the Java API are usually available, but there are typically several competing and mutually incompatible versions with overlapping functionality which cannot easily be used together.
  • Garbage collection facilitates programming and the safety of program execution considerably as programmers do not need to dynamically allocate memory and then remember to free it later.
  • Java is easier to teach and learn because of its streamlined syntax. It inherits less baggage from the C language, most notably in bypassing the need to deal with pointers.
  • The lack of pointers means that buffer overflow bugs (and, consequently, security exploits) are practically impossible in Java. Built in bounds checking prevents an errant program from overwriting the end of a memory buffer or assigning the value of an incompatible data type to a variable.
  • These built in checking mechanisms in Java make it a more robust software environment. On the other hand, they also make Java execution slower (see below).
  • Java can be programmed for multiple plaforms with little regard towards platform-specific characteristics like hardware data types, floating point implementations, or OS libraries. Java programs are compiled into binary bytecode which will execute properly on any standards-compliant JVM, on any architecture, without modification.

Disadvantages of Java

  • Access to native operating system and hardware functions requires a non-Java access library be coded to the JNI (Java Native Interface) API specification. Java programs cannot directly access such services.
  • No compile-time "template" generic containers. (this is slated for inclusion in version 1.5 due to popular demand.)

Advantages of C++

Disadvantages of C++

Differences between the languages

  • C++ has operator overloading. This was not included in Java in order to keep code more readable. While there can be little doubt that this feature is often misused in C++, decreasing readability, there are also numerous good uses, such as in mathematical and scientific programming, where its use improves readability. Because the biggest application area for the Java programming language is business software, operator overloading is still considered by the language designers to be unnecessary, though many hold this position in contention.
  • All objects in Java are pass-by-reference, and are dynamically allocated.
  • Java constants (the "final" keyword) are only enforced within class scope.
  • C++ has flexible support for pointer manipulation, while Java only allows one to assign object references.
  • There is no "goto" in Java (though it is a reserved keyword and barred from use.)
  • C++ supports multiple inheritance while Java uses "interfaces". They each have their advantages and disadvantages. Multiple inheritance is often more logical and representative of how one conceptualizes a problem. However it also complicates member overloading and inheritance, and even its proponents only recommend its use sparingly. Java interfaces significantly simplify its single inheritance model syntax, but can result in larger and less intuitive source code.
    • Some degree of multiple inheritance functionality can also be gained by using "inner classes"

External References:



In the News

Light To Moderate Drinking Reduces Risk Of Cardiac Events, Death
Older adults who consume one to seven alcoholic beverages a week may live longer and have a reduced risk for cardiac events than those who do not drink -- an association that appears independent of the anti-inflammatory effects of alcohol, according to a report in the July 24 issue of Archives of Internal Medicine, one of the JAMA/Archives journals.

Tracing Marijuana To Its Roots: Scientists Seek Marijuana's Isotopic F
Scientists at the Alaska Stable Isotope Facility can tell whether marijuana confiscated in a traffic stop in Fairbanks likely came from Mexico or the Matanuska Valley. They're also working on a way to determine whether it was grown indoors or out. A few more years and enough samples and they hope to have something even more precise: an elemental fingerprint that could tell police where and under what conditions a sample of marijuana was grown.

Teamwork Between Two Key Proteins Necessary For Normal Development And
Researchers studying hemoglobin genes, mutations of which play a role in genetic blood disorders like sickle cell anemia and beta-thalassemia, have identified two proteins that are responsible for regulating overlapping groups of genes during the development of red blood cells.

Urban Britain Is A Recipe For Heart Disease
Researchers at The University of Manchester's Medical School, working with teams in India and Birmingham, have found that people moving from South Asia to the UK significantly increase their risk of contracting cardiovascular disease (CVD).

Discovery Could Help In The Development Of Sensors Against Chemical Th
Single-walled carbon nanotubes (SWNTs), which could play an important role in developing sensors against chemical threats, have enhanced interaction with ammonia because of the presence of oxygen groups on the nanotubes, researchers at Temple University have discovered.

Newly Discovered Immune Defense May Be Impaired In Cystic Fibrosis Air
A recent University of Iowa study reveals a new immune defense mechanism in normal airways and may help explain why people with cystic fibrosis are particularly susceptible to bacterial lung infections. The findings also may point the way to new approaches for treating the disease.

Scientists Find Mutations That Let Bird Flu Adapt To Humans
By comparing influenza viruses found in birds with those of the avian virus that have also infected human hosts, researchers have identified key genetic changes required for pandemic strains of bird flu.

Cedars-Sinai Researchers Demonstrate A New Way To Switch Therapeutic G
A gene therapy research team at Cedars-Sinai Medical Center has developed a new method of signaling therapeutic genes to turn "off"or "on,"a mechanism that could enable scientists to fine-tune genetic- and stem cell-based therapies so that they are safer, more controllable and more effective.

Graphite warms to superconductivity
Graphite, the layered form of carbon, is not normally a superconductor. But, if you slip a few metal ions in between the sheets it behaves very differently...

Australian Company Reports Progress In Development Of Testosterone Lot
Acrux Limited, the Australian pharmaceutical company which specialises in administering drugs through the skin, today announced positive results from two more clinical studies of its Testosterone MD-Lotion® treatment for testosterone deficiency in men.


MP3 Music Downloads

Preview songs, Download Free Music,Burn CDs at ITunes.com
iTunes_RGB_9mm

 


Google




InformationQuickFind.com - Find Information Fast

Links