Question:
can c++ replace java?
2008-05-23 11:14:28 UTC
i am learning c++ and someone suggested that java is better than c++ so u should learn java after c++ would it make me confused with syntax and func of both ?? what is the scope............
should i learn it ??
Fourteen answers:
MPHC
2008-05-23 11:17:58 UTC
learn java first before you learn c++ because c++ is an improvement of java

meaning things u can do in java u generally can do in c++



however if u get spoiled with C++ then its hard to unspoil your self with java....



thats what i think
2008-05-26 20:07:39 UTC
You sort of have it backwards. Java was created to be portable (can run the same code on many different platforms), clean syntax (based closely on C++), safe (Java runs inside a "virtual machine" on top of the host operating system) and open (source: Exploring Java. Niemeyer and Peck. O'Reilly. 1997).



So if you learn either, you'll find that the other will follow without too much trouble. You will spend your time learning the differences between the two rather than re-learning everything from scratch. That said, the differences are not trivial. Java was designed later than C++ and with different goals. In order to achieve those goals Java uses a different design. Some notable differences (you may have to check Wikipedia for some of these points):



Java has no pointers: in C and C++ you can talk about *where* in memory something is stored, not just *what* is stored there. Think of the difference between a house and a street address. The actual house is what contains all the people (or pets, pots and pans, etc.), and the street address tells you where that house can be found. To extend my metaphor farther, you also have to know what kind of address you have. Apartments have additional numbers (telling you what apartment is at an address), or foreign addresses may not have a zip code (etc. etc). In C or C++ pointers point to a type (like an integer, a character, etc.). You can add one to an address (in the house example, this would get you the next-door neighbor). There is a lot more to this, but you should get an impression.



Java has automatic memory management. When you ask for a new object in Java:



String person = "John Doe";



It allocates (frees up) memory to use for those characters that will constitute the string. A similar thing in C would be:



char *person;

person = (char *) malloc(10);

person = "John Doe\n";



What happened here is that we made a pointer to a character (char *) then we Memory ALLOCated space for 10 characters and told C that we want character pointers. Then we assigned some characters to that place.



Java is garbage collected: This means that after we go around allocating memory for a while, Java stops periodically and checks to see that we still need it. If it finds unused memory (we don't hold onto anything that would need that memory), it frees it up again. This eliminates a class of error called a "memory leak," or asking for memory, but never giving it back.



Java also makes sure that you don't go past the ends of arrays. This can be nasty in C, resulting in a core dump or worse. This is because C will happily overwrite space that has already been set aside for other things. In particularly awful cases, this lets malicious users insert their own code into your program, by "slipping" it in after your allocated space was supposed to end.



I hope this gives you a place to start when people talk about the differences between the two.
Paul B
2008-05-23 20:26:26 UTC
c++ is not as commercially popular as Java seems to be these days. If you want to make software development a living then you're going to have to get used to learning new languages. In real terms the step from c++ to Java is a very easy one so I'd say go for it.
?
2008-05-25 20:12:36 UTC
both c++ and java are high - level languages

u can learn any one of them first and then the other

some features of c++ are not available in java whereas some of java aren't available in c++

both of them stand on the same base, i.e., OOP(Object Oriented Prgramming)



another thing is that java is a little bit harder than c++ so u must learn the easier one, i.e., c++ first

vaise their concept is almost same



happy choosing

:):)
Joe S
2008-05-23 18:22:55 UTC
C++ and Java are almost the same syntax.



In my opinion if you are focusing on one language to learn I would go for C# since it is more widely used and very similiar to both. C++ is dead and Java isn't much fun.
myportraitdrawing
2008-05-23 18:20:12 UTC
If you can learn c++ you can easily learn java. Most people nowadays use java, unless you are programming games. They are pretty much interchangeable. C++ tends to be harder to manage in terms of bugs, but there are more libraries available to do advanced stuff with C++.
Guddu G
2008-05-25 07:06:56 UTC
adjectly java is better

but it can not replace c++ because both has its own nature and means

but if you are learning c++ be continue because java is upgradation of c++

java has its own way to write syntex and function

java has taken syntex from c language and concept of oops from c++ so it is better to learn c++ be4 to learn java it will be help ful for you
Alfa C
2008-05-23 19:53:57 UTC
well..i have done C++ in my +2 and i m learnin java now..

java is definetely easier to learn dan C++...

i think learnin java is a must...

java was developed by "sun" keepin in mind the networking needs in any programming language..

so many implementations of a java program 'll be hard in C++..

memory management in java is also automatic..

so..

again dis makes our job simpler..

i d say..

spend some time and learn java..

it 'll definetely help
kunnu
2008-05-25 13:49:20 UTC
dont give up C++...first learing C++ it enables you to get clear in OOPs concepts.C++ n JAVA r little confusing in syntax but if you get good coaching you can differenciate them.java is simpler than C++ in many aspects n its usage is wide!!

NOTE:learn both so that you will be sound in programmingALL THE BEST!!
2008-05-24 14:02:14 UTC
they are both very useful but currently c++ is used in more applications. java is used mainly on the internet.

java seems more straight foward then java. i also suggest jcreator for your environment
Varun
2008-05-23 18:23:15 UTC
C or C++ is the base for any Programming langauges. If you are not good at C++ , you can never prove yourself in Java
subbu
2008-05-25 13:46:08 UTC
first learing C++ it enables you to get clear in OOPs concepts.C++ n JAVA r little confusing but if you get good coaching you can differenciate them.ALL THE BEST!!
sinkablehail1978
2008-05-23 18:48:12 UTC
Learn C++, it will give you a solid grounding in the rules of OOP's.
2008-05-23 18:17:49 UTC
yes


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...