As you know this course has 2 C courses Comp122 and Comp220

As you know, this course has 2 C++ courses (Comp122 and Comp220) as its necessary pre-requisite. Luckily, Java is almost identical to C++ in its basics so you should be able to directly build upon your pre-requisite knowledge from those courses to delve even deeper into more complex Object-Oriented Programming (OOP) ideas here.

So even though it\'s the start of your journey of Java, let me ask everyone: what kinds of differences are you noticing, e.g., in the process of compiling and running Java vs C++ programs? Let\'s identify some of the different statements that are basically the same in Java and C++.

Solution

Hi, Please find my basic comparison between C++/Java. It gives you basic overview

Language syntax is similar, but C++ compiles down to system-level bytecode, and runs natively on the underlying platform.

As you can guess, different systems have different compilers, and implementations of the lanugage, and there is no guarantee that C++ program that\'s written for one platform will perform on another. That\'s why C++ has got so many cross-platform libraries to make the transition easier.

Java on the other hand compiles to the JVM (Java Virtual Machine) bytecode.

Java Virtual Machine is an abstraction layer software placed between the physical machine, and the actual program.

This in theory allows every Java program to be run on the machine that supports Java without a need to rewrite your program. Their famous moto is \"Write once, run anywhere\". In practice, it\'s usually not really like that, but it\'s still much easier than writing a C++ cross-platform code.

Now, these are the basic differences.

On the language level, they both have C-like syntax, but they\'re not the same languages.

C++ supports OOP, while Java is OOP out of the box.

C++ supports multiple class inheritance, while Java only gives you a single class inheritance, but solves the multiplicity via interfaces.

C++ has got a pointers, and can directly manipulate/violate the memory addresses.

Java is a type-safe language, and you have no availability of pointers in Java. They\'re present in the background, but not on the scene.

Generics in Java, and templates in C++, are 2 different beasts

Java does not support default arguments like C++.
Exception and Auto Garbage Collector handling in Java is different because there are no destructors into Java.
Java has method overloading, but no operator overloading just like c++.
Java is pass-by-value
Java does not support unsigned integer.

As you know, this course has 2 C++ courses (Comp122 and Comp220) as its necessary pre-requisite. Luckily, Java is almost identical to C++ in its basics so you s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site