How Java Different From C And C++



In the previous articles i explained : History of Java, What is Java Technology, Asp.Net Alert Box, Asp.Net Setup and Deployment, Asp.Net Connection String, Asp.Net Authentication and Authorization and Facebook sidebar like box for website.


In this article i will explain how Java differs from C and c++, what is the main difference between C++ and Java in tabular form, why java is better than C++ and also comparison b/w C vs C++ vs Java.

To build a better language, Java was improved on C++. It has changed and improved upon the powerful and difficult C++ features. The following are the differences from C and C++ that exist in Java :

  • Java does not have preprocessor, and as such, does not have macros like #define. Constants can be created by using the final modifier when declaring class and instance variables.

  • Java does not have template classes as in C++.

  • Java does not include C's const keyword or the ability to pass by const reference explicitly.

  • Java classes are singly inherited, with some multiple inheritance features provided through interfaces.

  • Add functions must be methods. There are no functions that are not tied to classes.

  • The goto keyword does not exist in Java (it's a reserved word, but currently unimplemented). You can, however, use labeled breaks and continues to break out of and continue executing complex switch or loop constructs.

  • Java does not use pointers.

  • Java doesn't contanin the data types: struct, union, enum.

Give your Valuable Comments.
comments powered by Disqus
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles