C++ vs Java

There are many differences and similarities between the C++ programming language and Java. A list of top differences between C++ and Java are given below:

Note

  • Java doesn't support default arguments like C++.
  • Java does not support header files like C++. Java uses the import keyword to include different classes and methods.

C++ Example

File: main.cpp

snippet
#include 
using namespace std;
int main() {
   cout << "Hello C++ Programming";
   return 0;
}

Java Example

File: Simple.java

snippet
class Simple{
    public static void main(String args[]){
     System.out.println("Hello Java");
    }
}
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +