Java
  Home arrow Java arrow Page 4 - Syntactic Comparison of Java and C/C++
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
JAVA

Syntactic Comparison of Java and C/C++
By: Barzan "Tony" Antal
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 11
    2007-11-21


    Table of Contents:
  • Syntactic Comparison of Java and C/C++
  • Data Types
  • Pointers
  • Summing Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Syntactic Comparison of Java and C/C++ - Summing Up
    ( Page 4 of 4 )

    Now is the perfect time to sum up what we’ve just learned. First of all, Java as a programming language was consciously simplified and the most common sources of trouble were eliminated, either completely or by incorporating specific safer workarounds.

    You can add comments the same way in both languages, either the // per line or the /* */ for multiple lines. These are called implementation-comments and they’re derived from C/C++. However, Java has document-comments too. You can delimit these using /** */ tags. Additionally, these can be exported to HTML using javadoc.

    Using operators = and == in Java considers only the references. If the coder wants to either copy or test the equality of two objects/arrays s/he should use clone() and equals(), respectively. A null in Java is not akin to 0 per se, it stands for a void reference.

    C-like pointers do not exist in Java. They are created as references and de-referenced automatically. Some might argue that Java has some kind of pointers; well it has, but they are not true pointers from a C/C++ point of view — there is no pointer arithmetic at all.

    The idea of restrict programmers from directly manipulating addresses of the memory was mostly carried out to enhance the security of the language. Yes, one of the reasons is to provide more of a type-safe coding. But the most important underlying reason is that it gives less control over the system’s resources to programmers. Thus it drastically decreases the opportunities to code malicious programs (e.g., buffer and/or stack overflow, etc.).

    The last syntactic difference between Java and C I want to point out before I finish this half of the two-part series is about global data and variables. In Java there are no structs or unions. Everything is part of a class. Static methods behave like globals inside a class.

    Until next time, keep coding! Stick around; you won’t want to miss the next part.



     
     
    >>> More Java Articles          >>> More By Barzan "Tony" Antal
     

       

    JAVA ARTICLES

    - Exception Handling Techniques in Java
    - More About Multithreading in Java
    - The Basics of Multiple Threads in Java
    - Data Access Using Spring Framework JDBC
    - New Object Initialization in Java
    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek