Difference between cpp and java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Difference between cpp and java

i m confused that should i also learn java...for making webpages (is it used for making) and for what other purpose these languages are use?

11th Feb 2018, 6:40 PM
DEEPENDU PANDIT
DEEPENDU PANDIT - avatar
8 Answers
+ 14
hi @MISAmisa if you are a beginner then I will like to suggest you to choose C++ first it will clear your concepts of object oriented programming and will help you to understand how logics are worked by using object oriented concepts basically C++ and Java both are object oriented programming languages but Java is purely object oriented programming language the major difference between this two languages is that that Java is platform independent language it can be executed in any platform because it's create jar file with. jar extension which can be executed at any platform that's why it is mostly used in android App development both languages are somehow connected with each other because both follow the object oriented concepts like inheritance encapsulation abstraction both are language which is came under app development if you are familiar with C++ then go with Java else first go with C++ and then go for Java
11th Feb 2018, 6:51 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 8
Javascript is commonly for web pages - Javascript is not related to Java ( names are just similar)
11th Feb 2018, 6:49 PM
Manual
Manual - avatar
+ 3
http://cs-fundamentals.com/tech-interview/java/differences-between-java-and-cpp.php Here’s the differences. However, if you want to make web pages, learn HTML, CSS, JavaScript, etc. Java is for programming things like Android applications.
11th Feb 2018, 6:44 PM
luciel
luciel - avatar
+ 2
I would add very important note.Java is interpreted language (it runs on virtual java mashine which is running on the praticular platform) and C++ is compiled language (the code is natively running on the particular platform.) From that reason the java code is more more slower than C++ code.
11th Feb 2018, 7:12 PM
Highman
Highman - avatar
+ 2
C++ is a lower level then java and with it, you can manage memory and inject assembly codes (very low level and cpu dependent languages) but at same time permits good abstractions from machine ... Java memory allocations is managed by Java Virtual Machine (which execute compilated java code and its similar to a machine software that run on machine hardware)... With latter you can forget to deallocate memory, tha JVM will do for you...Less errors but less power... Either are used for apps development (but C++ is used where perfomance and power are constrictions also) but Java is used also on web developmemt (web apps and serverlets)
11th Feb 2018, 9:58 PM
KrOW
KrOW - avatar
+ 2
In the beginning of Internet times, people used to embed Java applets on webpages, but today they are totally deprecated due to security reasons. Thus Java is useless for web pages (as someone already said, don't confuse it with JavaScript). Java runs in a virtual machine, so the code is easily ported to many different systems. At the same time, it is precompiled, so it's faster than Python, Ruby or other interpreted language. Java is very popular in the world of business applications and it is also used to make Android applications. C and C++ are compiled directly to machine code, so it has to use one compilation for each system. And although some codes can be compiled directly to any system, othet codes that go really low level, like mixing Assembly with it, must be adapted to each system; if it uses some exclusive system libraries, the same happens. But they're used to make big applications like photoshop, office suites, games (the big ones of the big companies, not the ones sold at apple/google store) and even the systems itself like Windows, Linux, iOS &c..
12th Feb 2018, 5:52 PM
Bruno Della Motta
Bruno Della Motta - avatar
+ 1
@Martin Taylor: Right,but I am conviced that Java is generally understood as Interpreted language.The java source code is compiled into bytecode of course and than the intermediate code is interperted by a JVM. Of course there are more ways how to covert the bytecode into native code running on a particular platform,but as you have written it is also slower than pure native code.
12th Feb 2018, 12:45 PM
Highman
Highman - avatar
+ 1
Ok Martin, I was conviced that other languages than natively compiled are understood as interpreted because they need to interpreted (pure code or bytecode or clr) by a interpret mashine. Here is the best explenation I think: https://www.codeproject.com/Articles/696764/Differences-between-compiled-and-Interpreted-Langu The link says that this topic is little wasted:))) Thanks for your correction dude;)
12th Feb 2018, 4:18 PM
Highman
Highman - avatar